Aug
23
2011

Essential VIM Plugins for Web Developers

Laziness is a virtue that every programmer needs to some degree. Efficiency is always a trademark of a good programmer. A programmer’s effort should be directed in a way to achieve maximum outcome in less time.

I have seen many programmers opting for vim editor. Yet, most of the programmers are unaware about the plugins available for vim editor. These plugins drastically extend its capabilities whilst reducing the effort you need to put in.

In this stone, I have listed 7 plugins for vim which are more lenient towards web developers. I have included plugins for tags, comments, parenthesis and quotes, exploring filesystem and listing recently used files. Snipmate, sparkup, matchit plugins are especially helpful in writing and finding tags, NERDTree for exploring filesystem, NERDCommenter for comments and mru for recently used files.

Before you begin reading this article, I recommend you to go through our previous stones on vim.

Snipmate

A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a <tab>.

For instance, in a HTML file, if you type “html<tab>” in insert mode, it will expand into

<html>
</html>

By default this plugin has 17 predefined snippets for more than a dozen language. e.g. C , C++ HTML, Java , JavaScript, Objective C, Perl, PHP, Python, Ruby, Tcl, Shell, HTML, Mako templates, LaTeX, VimScript. So, don’t forget to check in ~/.vim/snippets directory.

Installation

1. Download snipmate.zip

2. Extract to .vim directory

unzip snipMate.zip -d ~/.vim

To activate the helptags, type in the vim editor

:helptags ~/.vim/doc ( Now you can read help by running :help snipmate )

3. Restart the vim editor

Remember to enable filetype-plugin-on by adding filetype plugin on in .vimrc file found in ~/.vim/ directory.

snipMate.vim Introductory Screencast from Michael Sanders on Vimeo.


Sparkup

This has to be one of my favorite vim plugin. It allows you to rapidly create HTML structures.

For instance, in a vim editor, if you type

nav > ul > li > a*4 { Links }

and press Ctrl + E , it will expand into

<nav>
   <ul>
      <li>
         <a href=""> Links </a>
         <a href=""> Links </a>
         <a href=""> Links </a>
         <a href=""> Links </a>
      </li>
   </ul>
</nav>

Ultimately, you will be saving a lot of time while coding. For more tutorial on Sparkup, go through this link

http://net.tutsplus.com/tutorials/other/vim-essential-plugin-sparkup/

Installation

1. Download Sparkup zip file

2. Extract to a directory

unzip sparkup-20091205.zip -d sparkup

3. Move the folder ftplugin inside snipmate to .vim directory

cd sparkup/vim

mv ftplugin ~/.vim/ftplugin

4. Run :helptags ~/.vim/doc ( Now you can read help by running :help sparkup )

5. Restart your vim editor


3. Surround

This plugin is a tool for dealing with pairs of “surroundings.” Examples of surroundings include parentheses, quotes, and HTML tags.

For example, if you place the curson inside the text, foo and type dst in normal mode of vim , then the tag gets removed to give you foo.

For more information, check out Peteris Krumins’ blog.

Installation

1. Download surround.zip

2. Extract surround.zip to surround

3. mv surround/plugin/* ~/.vim/plugin/
mv surround/doc/* ~/.vim/doc/

4. Run :helptags ~/.vim/doc

5. Restart vim

Type :help surround to read help


4. NERDTree

The NERDTree plugin allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you can manipulate with the keyboard and/or mouse.

type :NERDTree to open this plugin. You will see a sidebar with list of files of your current directory.

Installation

1.Download NERD_tree.zip

2.Extract the file
unzip NERD_tree.zip -d ~/.vim/

 3.Run :helptags ~/.vim/doc

4.Restart vim

Type :help NERDTree to read help

For more information, check out Peteris Krumins’ blog.


5. NERDCommenter

The NERD commenter provides many different commenting operations and styles which are invoked via key mappings and a menu.

Installation

1. Download nerdcommenter.zip

2. Extract the file
unzip nerdcommenter.zip -d ~/.vim/

3. Run :helptags ~/.vim/doc

4. Restart vim

Type :help NERDCommenter to read help

For more information, check our this link.


6. MRU

The Most Recently Used (MRU) plugin provides an easy access to a list of recently opened/edited files in Vim. This plugin automatically stores the file names as you open/edit them in Vim.

Type :MRU in vim editor to use this plugin. It will display the recently opended/edited files.

Installation

1. Download mru.vim file

2. Copy the file to ~/.vim/plugin/ directory

cp mru.vim ~/.vim/plugin/


7. matchit

The matchit.vim script allows you to configure % to match more than just single characters. You can match words and even regular expressions. Also, matching treats strings and comments intelligently.

For instance, this plugin is able to find the HTML tag pairs.  Place the cursor in thetag, press % and it will find its pair i.e.

vim plugins

……

Installation

1. Download matchit.zip

2. Extract the file
unzip matchit.zip -d ~/.vim/

3. Run :helptags ~/.vim/doc

4. Restart vim

Type :help matchit to read help

For more information, check our this link.


Subscribe to fortystones.
Follow @fortystones on Twitter.
Get updated from our Facebook Fanpage.

Share

Related Posts

About the Author: Rabi C Shah

Rabi C Shah, pursuing his under-graduate program with a major in Information Technology in Indian Institute of Information Technology Allahabad (IIIT-A), is a passionate programmer. A Photoshop enthusiast, he is interested in Linux, C and C++. Rabi has completed many mini college projects in java and php. He is the Linux guy of our fortystones team.

21 Comments + Add Comment

  • [...] Szimpatikus.hu Közösség, a “Jó kis VIM pluginok. Te melyiket használod? Használsz esetleg másmilyet?” című bejegyzésre szeretném felhívni a figyelmeteket. Várom a hozzászólásokat, [...]

  • [...] Posts Essential VIM Plugins for Web Developers 10 Tips to Make Your C Program Effective Navigation in [...]

  • thank you very much :D

  • 1. Download Sparkup zip file

    2. Extract to a directory

    Hi!

    I’m installing them one by one, but I found problems with the second. According to your instructions we do not create nothing on .vim/doc folder from sparkup, so there’s no new help files there. So, for me :help sparkup says that there’s no help for that.

    Any hint?

    TIA,

    :wq!

    ;-)

  • The cure: Learn which, if any, foods trigger a headache for you personally – by paying attention to your diet and keeping a
    “headache diary. Headaches are able to do greater than destroy your
    mood – they’re able to obstruct your life. Doctors aren’t sure what could cause this mri scan side-effect, nonetheless it doesn’t apparently cause any permanent harm.

  • As in therapy, clarifying the parameters with the Patriot Act and containing its use is a significant cornerstone for that establishment of trust.
    Services for those who have more severe psychological disorders such as
    affective disorder or clinical depression, psychotic episodes or personality
    disorder will also be offered. We live in the world where poverty prevents a
    persons development by obliging everyone to forget their moral principals so that you can survive.

  • Simply desire to say your article is as surprising. The clarity
    in your post is just nice and i can assume you’re an expert on this subject. Fine with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the rewarding work.

  • The standby time with the medication cause serious unwanted side effects associated with their use, including
    liver damage, and liver, weakened body’s defence mechanism and heart failure. Add two teaspoons of using apple cider vinegar in two cups of cold clean water. Gluten will be the protein portion that is found in many grains, in fact it is an ‘Inflammatory Food’ whether or not you have an ‘allergy’ to it.

  • It should therefore function as responsibility in the attendant to look at
    the heat from the bolus before applying
    it on the affected parts. Such conditions, which bring about neck
    pain, are: osteoporosis or tumors, ruptured or degenerated cervical disc, nerve
    dysfunctions, bone spur, spondylosis or congenital problems.
    Spinal decompression treatments are used primarily to deal with disc
    injuries from the neck and minimize back.

  • Hello, I would like to subscribe for this web site to obtain
    latest updates, therefore where can i do it
    please assist.

  • Your blog, “Essential VIM Plugins for Web Developers | fortystones” was
    indeed truly worth commenting here! Really wanted to say you did a
    terrific job. Thanks for the post -Chong

  • Year-round demand invariably results in heightened competition.
    You will get a possiblity to play against real human players while you play these DS games in multiplayer mode.
    So not only may be the picture quality bad, you’ll have bad muffled audio for your videos.

  • Hey I know this is off topic but I was wondering if you knew of any widgets I could
    add to my blog that automatically tweet
    my newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  • When your discs realign, pressure is slowly removed from your nerves
    and you will feel plenty of relief from lower back pain.
    The process involves deliverance of small currents at tips along
    your nervous system. s very important for them to observe good posture, both sitting and standing to
    have their spine and neck in alignment.

  • This is very interesting, You’re a very skilled blogger. I have joined your rss feed and look forward to seeking more of your wonderful post. Also, I’ve shared your web site in my social
    networks!

  • This herb is found to be most reliable pain killer, and anti-inflammatory herb specially
    in the cases of arthritis and sciatica. Arthroplasty or combined
    replacement surgery are usually necessary in eroding varieties of osteoarthritis.

    In wintertime therefore immediately after fomentation, the affected part must be covered with some
    wool engarment.

  • Even in more serious conditions, a herniated disc for example, the pain can and frequently will go away without treatment, due to the proper care and therapy.
    Sudden low back pain may indicate a trauma or pulled muscle, you begin
    lower back pain exercise, seek advice from your health care provider.
    s very important for them to observe good posture, both sitting and standing to keep their spine
    and neck in alignment.

  • I like looking through an article that will make men and
    women think. Also, many thanks for allowing for me to
    comment!

  • We simply have to understand the symbolic dream language as a way to have a direct communication while using wise unconscious mind.
    Another strategy which is used while in treatments are an
    evidence-based trial-and-error technique. After some time, the addict’s environment is pervaded with cues — reminders from the drug
    that create the release of dopamine within the brain and predict a reward.

  • I really love your blog.. Excellent colors & theme. Did you build this site
    yourself? Please reply back as I’m hoping to create my own site and would like to know where you got this from or just what the theme is named. Cheers!

  • First Trimester covering the following course topics:. Staying far from these could lessen the risk or persistence of the disease.
    For other cancers or quality health articles, please visit.

Leave a comment

*