Skip to content

Make text objects with various elixir block structures.

Notifications You must be signed in to change notification settings

andyl/vim-textobj-elixir

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vim text objects for elixir block structures

This Vim plugin makes text objects with various elixir block structures. Many end-terminated blocks are parsed using regex, indentation and syntax highlight. This is more correct than parsing text with regex only.

Simple one operator-pending mapping e

Elixir text objects include: 'setup_all', 'setup', 'describe', 'test', 'unless', 'quote', 'case', 'cond', 'when', 'with', 'for', 'if', 'defprotocol', 'defmodule', 'defmacro', 'defmacrop', 'defimpl', 'defp', 'def'.

Example:

#\% is the place of your cursor.

def hoge(yo) do
  if yo do
    IO.puts "yo!"
    #\%
  end
  IO.puts "everyone!"
end

Typing dae removes whole if block

def hoge(yo) do
  #\%
  IO.puts "everyone!"
end

or die removes innner if block.

def hoge(yo) do
  if yo do
  #\%
  end
end

When a cursor places at line 6,

def hoge(yo) do
  if yo do
    IO.puts "yo!"
  end
  IO.puts "everyone!" #\%
end

type die removes inner def block.

def hoge(yo) do
end

This plugin requires vim-textobj-user

About

Make text objects with various elixir block structures.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%