Supposing you are whipping up some PHP code in Vim and want to quickly check the PHP documentation for the function you just typed. I wrote a quick little script to do just that. It uses the _open_ command is OSX to launch your default web browser to the page in the online PHP documentation for the function name under your cursor. All you have to do is press shift+K
Create a bash script containing the code below and place it somewhere in your system path. I placed mine in my ~/bin/phpdoc.sh and add ~/bin to may system path. Make sure the file is named _phpdoc.sh_ and is executable (chmod a+x phpdoc.sh)
#!/bin/bash open http://php.net/"$*"
Add this line to you .vimrc
autocmd FileType php set keywordprg=phpdoc.sh
- Open up a php file in vim
- Place your cursor over a php function name
- Press shift + K
You should see your default web browser open to the PHP documentation page for the function under your cursor.