I often use commands like ci(
and di{
when editing source code.
Parameters in Ruby blocks are contained inside pipe characters, like |a, b|
Is it possible to extend this behavior to add support for |
, so that commands like ci|
, da|
and yi|
work properly?
I have the following in my vimrc (I have added the va|
and vi|
commands for completeness):
nnoremap di\| T\|d,
nnoremap da\| F\|d,
nnoremap ci\| T\|c,
nnoremap ca\| F\|c,
nnoremap yi\| T\|y,
nnoremap ya\| F\|y,
nnoremap vi\| T\|v,
nnoremap va\| F\|v,
The ,
operator repeats the previous F
,f
,T
or t
but in the opposite direction. A very useful key!
These mappings can be easily modified to support other delimiters; I use the $
versions all the time when editing LaTeX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With