The default behavior of the K command is to lookup the keyword under the cursor using man. This is handy at times, but it's not very useful when I spend 90% of my day writing PHP code. Vim's online help mentions that you can set keywordprg to an alternative program, so I did the following.
set keywordprg=/home/travis/pdoc
Where pdoc is the following shell script:
#!/bin/sh
firefox http://us3.php.net/manual/en/function.$1.php
Now I can move the cursor over a builtin function, hit K, and firefox will open to the appropriate documentation. To keep things strictly textual, you could use lynx (or links) in lieu of firefox.
For ruby code, I like to do the following:
set keywordprg=ri
For Perl:
set keywordprg=perldoc\ -tf
Subscribe to:
Post Comments (Atom)
3 comments:
I found a way to do this for Windows, inspired by your tip. Just put the following in a file called $VIM\vimfiles\ftplugin\php_help.vim
Doh! It won't let me post it because it thinks it's HTML, and I can't see any option to quote it. OK, you can download the file from here instead:
http://www.software3d.com/php_help.vim
I did it via a mapping without any reference to an external batch file.
Rob.
Nice. I just started working with perl again, and this is perfect for trying to remember what stuff does.
Very cool Rob. Thanks for the contribution!
Post a Comment