VIM's keywordprg for Perl and ... VIM itself
This is logical follow-up to my previous post about K shortcut.
The two (actually three lines) added to ~/.vimrc allow when editing Perl and VIM scripts to transparently call with K proper help system.
au BufReadPost *.pl set keywordprg=perldoc\ -f
au BufReadPost *.vim map K :exe ":help ".expand("<cword>")<CR>
au BufReadPost .vimrc map K :exe ":help ".expand("<cword>")<CR>
Perl one is obvious. VIM one actually required some trickery: we do not call external program, but call VIM's internal command instead.
P.S. BTW,
:help :help
is pretty useful reading. Due to my error, 'K' in VIM mode used to constantly show it, instead of expected 'expand("<cword>")'.
1 comment:
Hi,
You can also add in your .vimrc
runtime ftplugin/man.vim
and add a mapping for K
nnoremap K :Man
It's very cool you have a man with coloration. But with map perldoc I don't how use that.
Post a Comment