5 Plugins You Should Put in Your Vimrc

5 vim plugins

Photo by Velo Steve

There are more than 4000 Vim scripts out there. This is one of the reasons why Vim is so awesome. However, if you are starting with Vim, you might wonder from where to begin. In this post we are going to talk about 5 plugins that can be found in almost any vimrc.

Surround

Surround

Surround provides mappings to easily delete, change and add surroundings in pairs. It’s created by Tim Pope, and it’s starred more than 800 times on GitHub.

The best way to explain it is to show some examples:

Go inside the following text and press cs”’:

1
"Hello world!"

It changed the double quotes to single. Cool, isn’t it? You can also remove them by pressing ds".

This plugin is really powerful and it can be extremely useful, check the documentation for more examples.

Command-T

Command-T

Command-T provides a fast mechanism for opening files and buffers with a minimal effort. Its name comes from the “Go to File” functionality in TextMate, bound to cmd + t.

Command-T is really advanced and it orders the files in your working directory, when searching, by an algorithm which knows that characters in certain locations should have more weight.

You can check this awesome screencast in order to view it in action.

snipMate

snipmate

snipMate is a plugin created by Michael Sanders. It’s an implementation of TextMate’s snippets features in Vim. A snippet is a often-typed text that you can easily insert by typing a word + tab. Here is an example:

If you are writing JavaScript and you type “for” in insert mode, it will expand a typical for loop:

1
2
3
for (var i = 0; i < Things.length; i++) {
  Things[i]
};

By pressing tab, you can switch between the highlighted items and change them.

snipMate comes with convenient snippets for C, HTML, JavaScript, PHP, Ruby, zsh, Vim and others. Apart from that, you can define your own snippets and make yourself even more productive.

Syntastic

Syntastic

Syntastic is a syntax checking plugin that runs files through external syntax checkers and displays any resulting errors.

There is a support for huge amount of languages, including C, CoffeeScript, CSS, Cucumber, Erlang, Go, Haml, Haskell, HTML, JavaScript, PHP, Python, Ruby.

Buffer Explorer

Bufexplorer

Bufexplorer is a plugin designed to optimise the browsing of Vim buffers. When you invoke it, it renders a sorted list of all buffers that are currently open. After that, you can easily sort, open or delete any of them.

You can open Bufexplorer by using one of the default public interfaces:

1
2
3
<Leader>be  - Opens BE.
<Leader>bs  - Opens horizontally window BE.
<Leader>bv  - Opens vertically window BE.

What’s your favourite Vim plugin? What are the most useful plugins that you know? Is there a plugin that you consider as really useful, but not quite popular? Let us know in the comments.

About the author

Veselin Todorov is a software consultant focused on testing, code quality and building awesome products. He is helping companies to ship their products with confidence and style.

If you are passionate about JavaScript, Node.js, TDD, building and growing applications, you should visit his blog at RobustJS.com