created 2003 · complexity basic · author Mark Stosberg · version 6.0
This tip shows some techniques for accessing information when editing a Perl program. See also Perldoc function and module keyboard mappings (which should be merged to here).
Open a Perl module
You may want to open the source code of a system Perl module that's installed. Here's one way to do that:
:e `perldoc -l Module::Name`
View perldoc information
If you use the K command in Perl files, it will try to invoke 'man' on Perl keywords/functions. But this does not make much sense. It is more useful to redirect K to use 'perldoc -f' in a Perl file. Add this to your vimrc:
au FileType perl setlocal keywordprg=perldoc\ -T\ -f
and K will lookup Perl function names using 'perlfoc -f' for you.
Comments
TO DO
- Cleanup this and VimTip614, and merge 614 to here.
- Rename this tip.
- I'm pretty sure all the autocmd suggestions are misguided (and should be deleted).
- Instead, show how to use an after/ftplugin/perl.vim file.
I had a quick try with the after file, but there is some weird stuff going on with iskeyword that I'd like to sort out before doing any further cleaning. JohnBeckett 05:00, 5 April 2009 (UTC)