Just use iE
for changing inside an erb tag, and aE
for changing
around it (<%
and %>
included).
In the gif, I:
- visually select inside the block with
viE
- change inside another block with
ciE
- delete around a block with
daE
E
is a mnemonic for an erb block. I didn't use e
(lowercase) since there's a
super useful vim-textobj-entire
which targets the entire buffer and uses e
as its text object.
This plugin is based on kana/vim-textobj-user and it depends on it.
I can't stop singing the praises of vim-plug as a plugin manager, but any of them will do.
" vim-plug
Plug 'kana/vim-textobj-user'
Plug 'https://github.com/whatyouhide/vim-textobj-erb'
" NeoBundle
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'https://github.com/whatyouhide/vim-textobj-erb'
" Vundle
Plugin 'kana/vim-textobj-user'
Plugin 'https://github.com/whatyouhide/vim-textobj-erb'
If you use pathogen, just clone the repository.
cd ~/.vim/bundle
git clone https://github.com/kana/vim-textobj-user
git clone https://github.com/whatyouhide/vim-textobj-erb
Open an issue if there's something wrong, or submit Pull Requests. I'm more than happy to get help!
© Andrea Leopardi