If you're primarily a Perl hacker and don't use C much, you might find it annoying when you hit 'K' in command mode. That's because VIM runs something like this:
nmap K :Map
I've just added the following to my .vimrc:
noremap K :!perldocperldoc -f
Now when you type 'K' in command mode, it will call up the appropriate perldoc, if possible.
I really should have added that to Perl Hacks. Damn.
If filetype plugin is turned on this also works:
autocmd FileType perl
And then K should still work as it did before when working with non-perl sources
Re:Perl specific remapping
Ovid on 2008-01-23T16:47:32
Nice point! I do have the filetype plugin enabled. Thanks
:)
autocmd FileType perl setlocal keywordprg=perldoc
If the perldoc -f || perldoc
behaviour matters, the preferrable way to do it is to plug a shell script that works that way into keywordprg
, which offers the bonus that you will have it available on the shell as well. If you really must, though, you can do it as a less than pretty one-liner:
autocmd FileType perl setlocal keywordprg=sh\ -c\ 'perldoc\ -f\ \$1\ \|\|\ perldoc\ \$1'\ --
As a start I added this one to the perl5 wiki on TPF
Re:what about module name
Aristotle on 2008-02-01T11:08:15
autocmd FileType perl setlocal iskeyword+=:Then vim will consider colons word characters for the purposes of cword.
Re:what about module name
Ovid on 2008-02-01T11:59:03
Oh, I have something analogous to that embedded in my vim stuff. I stole that trick from Damian.
Re:what about module name
raptor on 2008-02-01T20:20:37
nice, thank you