Last Updated: February 25, 2016
·
1.754K
· endel

VIM: Add "/" and "|" to text objects

This allow you to quick do things "inside" and "around" the "|" and "/" text objects. Like change/delete/yank and enter visual.

Add to your ~/.vimrc:

" Fake '|' as text object
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,

" Fake '/' as text object
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,

1 Response
Add your response

Add ".", ":", "|", "/", "\", "*" to text objects: http://codepad.org/TNVK7vO4

over 1 year ago ·