2011-03-09

Open online PHP reference from vim

Pressing K when over a keyword in vim usually opens the keyword's manpage. In Python it invokes pydoc instead. I wanted it to open PHP's online documentation when I press it over a function name in PHP. Easy.

I wrote a tiny shell script in my ~/bin directory first, phpman:

#!/bin/sh
sensible-browser http://php.net/"$*"

I then added to my .vimrc the line

autocmd FileType php set keywordprg=phpman

Done. And using sensible-browser has the added bonus that it'll run whatever my preferred graphical browser is when I am in X or a textmode browser when I'm not.

No comments:

Post a Comment