PHP Documentation Help In Vim

Vim IconSupposing 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

Install

Step One

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)

Step Two

Add this line to you .vimrc

Usage

  • 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.

Leave a Reply

Your email address will not be published. Required fields are marked *