Friday, September 4, 2015

Using as an indirection for commands

Just a note that seems worth passing on. Was curious whether there was a way to de-couple user defined commands in a plugin in a fashion similar to <Plug> and mappings.

A little trial and error; there is, via normal.

function s:bar()
echo "got here!"
endfunction

map <Plug>intermediary call <sid>bar()<cr>

command! Testme normal <Plug>intermediary

This serves strategy gives commands the same de-coupling that <plug> gives mappings. In my (admitably limited) searching I'd not seen this approach, and it seems worth passing on.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: