Skip to content
Tags

Some useful vim plugins for PHP

April 27, 2008

I am using vim as my default editor for all languages on all platforms. It provides great convenient and portability for me. I would like to share with you for some tips.

This is a great slideshow for php programmers who want to use vim as their editor. I copied his vimrc package and put in my home directory. Here are some useful plugins I just found today.

1. php-doc.vim

Usage: Choose the code snippet , in insert mode, press ctrl+p. It will generate php doc for you automatically. Awesome.

2. SnippetEmu

Usage, after you entered some keywords like for , while , swith …, press ctrl+b ( Andrei mapped ctrl+b instead of TAB to avoid conflicting with autocomplete). It will generate snippet for you automatically. You need to keep press ctrl+p to finish the snippet. I have to say, that’s very cool.

3. manpageview

This is very useful when you are not sure how to use one php/perl/shell function. It will open a split window and display helpdoc for you when you press K on keyword. You have to install links( a lynx-like text browser ). I don’t know why, but I only tried it successfully on my dev box( RHEL ). Need to take a look on vim script later.

4.netrw

I had found this plugin is very useful when I wanted to use my vim to edit remote files. But I found it could also browse remote directory. Just need to run :e scp://hostname/pathname

Useful key-map by Andrei

1. ,s/,q/,w : save/quit/write  

I hate to use :wq!. It requires endless key knocking which drives me crazy. This is a life saver. I wish I can sync my .vimrc and .vim directory on every machine I can login. 

2. Ctrl+b

I mentioned at SnippetEmu plugin

3.Ctrl+p

I mentioned at php-doc plugin

4.gf/gd/gg/gi: open file by using string under cursor/jump to define under cursor/the first line/the last insert place

5.“: jump back to last mark place.

6. :make: This will check syntax of your current php file and jump to the first error syntax line after pressing enter.

Too many awesome features to just be written here. I just wanna make you believe that vim is so powerful that everyone should at least try to learn it. BTW, I hate wordpress doesn’t let me use editor like vim. Maybe I should try to write in vim next time and copy to WP.

Happy viming. 

 

 

 

Advertisements

From → Uncategorized

One Comment
  1. ves permalink

    Hi, you should probably check out http://vimperator.mozdev.org/ if you haven’t seen it. It rocks my world, especially the ‘[[‘, ‘]]’ and CTRL_x and CTRL_a commands.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: