svermeulen / vim-extended-ft

26 stars 4 forks source link

Provide commands in addition to the <Plug> mappings? #9

Open yunake opened 8 years ago

yunake commented 8 years ago

Would you consider providing commands or other means of conveniently executing Search from external sources? My use-case is that I'm using custom omappings that do f motions, and would like to use your plugin motions instead of the default ones. e.g.:

onoremap in( :<c-u>normal! f(vi(<cr>

(i have a for loop that does execute to create a bunch of these for all kinds of brakets/quotes, forward and backward)

svermeulen commented 8 years ago

What I've done before is something like this:

omap [' <plug>ExtendedFtSearchTBackward'
xmap [' <plug>ExtendedFtSearchTBackward'
nmap [' <plug>ExtendedFtSearchTBackward'

omap ]' <plug>ExtendedFtSearchTForward'
xmap ]' <plug>ExtendedFtSearchTForward'
nmap ]' <plug>ExtendedFtSearchTForward'

There might be a way to do it with noremap too, something like this:

nnoremap [' :normal "\<plug>ExtendedFtSearchTBackward"<cr>'

But I haven't tested that so probably doesn't work