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.
By default this motion is mapped to 'e'. The key mapping can be overridden by adding a line similar to this to your vimrc:
let g:vim_textobj_elixir_mapping = 'e'Elixir text objects include:
caseconddefdefimpldefmacrodefmacropdefmoduledefpdefprotocoldescribeforifquotesetupsetup_alltestunlesswhenwithschemasetup_allsetupdescribetestobjectfieldinput_object
Example:
#\% is the place of your cursor.
def hoge(yo) do
if yo do
IO.puts "yo!"
#\%
end
IO.puts "everyone!"
endTyping dae removes whole if block
def hoge(yo) do
#\%
IO.puts "everyone!"
endor die removes innner if block.
def hoge(yo) do
if yo do
#\%
end
endWhen a cursor places at line 6,
def hoge(yo) do
if yo do
IO.puts "yo!"
end
IO.puts "everyone!" #\%
endtype die removes inner def block.
def hoge(yo) do
endThis plugin requires vim-textobj-user