# Vim Top Best Essential Favorite Plugins/Scripts – Increase my Productivity

Write my own top 5 list of vim scripts.

1. BufExplorer1: For the longest time, I worked with Vim by editing one file, saving and exiting, editing another file, saving and exiting and so on. Working with Emacs, I learned to stay in the editor for extended periods of time and opening a lot of files. When I came back to Vim, I needed something to make it easy to edit a large number of files in one session. :ls and :b were passable, but I disliked the two-step operation to switch from one buffer to another. (Note: it was only after I installed BufExplorer that I learned you can Tab-complete buffer names.) The folks from #vim quickly pointed me to BufExplorer, and it’s excellent! You use \be (or in my case, ,be) to display the list of opened buffers in your current window (the list is the same as the output of :ls.) You go over the buffer you want to visit and press Enter and you’re there. It’s quick and easy. I’m so used to it, sometimes I write ,be in irssi.Some people use minibufexpl, I tried it, but it didn’t seem to play too well along with Project, so I uninstalled it
2. Project2: One thing I always liked about IDEs and from the Textmate screencasts was the file list on the left of the screen. You can have that with Vim just by opening a directory, but you can sometimes lose the list and it’s annoying to bring it back. Listing the content of a folder also showed files you didn’t care about. Project.vim is a script that displays only the files you want in a vertical split window that always sticks around (even when you use C-w o.) You start a new project with the roject foo command. Once that’s done, \C will ask you a few questions (name of the project, absolute path of the project, file filters) and the files and directories will be loaded in that buffer. You write it (:w) and next time you open vim, you do roject foo and the file list comes back. I found this script to be extremely helpful in projects with a large number of files and directories.
3. NERD_Comment3: I write code, and often I want to comment/uncomment large portions of code. I could do it manually, but it’s usually slow, especially in languages such as Python where the comment character comments only until the end of line. NERD_Comment gives you a handful of commands to comment and uncomment code with a simple command. The most basic way to use it, select code in visual mode, press \c<space> and the section will be commented. Select the same section again (use gv) and do the same command, and the code will be uncommented. This is not a big time saver, but it’s quite useful.
4. Align4: Align is a plugin to align code according to a list of characters. Suppose you have the following code:
    firstname = 'Vincent'
lastname = 'Foley'
age = 23
height = 170
weight = 180
blog_url = 'http://gnuvince.net'
favorite_drink = 'beer'

Personally, I don’t like code that’s unaligned like that, I find it hard to read (Damian Conway, the author of Perl Best Practices agrees with me on that point.) The solution is to align the equal signs, but that’s kind of a drag to do manually. The Align script automates this process; the command :Align = will align the visual selection on the = character. You can use the :AlignCtrl command (which has a lot of options) to set how many spaces to pad with, left align or right align, etc.

    firstname      = 'Vincent'
lastname       = 'Foley'
age            = 23
height         = 170
weight         = 180
blog_url       = 'http://gnuvince.net'
favorite_drink = 'beer'

Small problem with Align however, in UTF-8, it does not deal well with accented characters. I contacted the author about this problem, but I haven’t seen an update so far.

5. taglist5: When you are brought into a large project, it’s sometimes hard to learn quickly where things are defined and whatnot. A good way to help is to use taglist (given that ctags supports the language you’re using) which will list classes, methods, functions, variables and other elements of your language and make them easy to access. This makes it easy to jump from one usage of a function to its definition.

There are a lot of VIM plugins to choose from. An individual’s list of what would be considered “essential” is largely a personal matter. For any given plugin, there is also probably going to be an excellent alternative plugin that does the same basic thing in a slightly different way. I’m just starting to use VIM for more than just quick edits of files on a server, and the plugins below are solving very specific workflow issues that I’ve encountered while learning to be productive in VIM.

warning: watch out for plugins, generally. For many (some included in my list of favorites here) might hamper your ability to understand the core functionality of VIM. Many times the problem is best solved by understanding how you can accomplish the task with just VIM, and not a plugin. One of the biggest barriers I had with getting over the initial learning curve was over-saturation with plugins, as I wrote here.

## Vundle

If any of these plugins had an “absolutely” in front of its “essential” descriptor, it would be Vundle.

Vundle is short for VIM Bundle. It is spiritually alike to Bundler, and provides a clean easy way to manage plugins that you install. In past VIM efforts, I didn’t use any sort of scheme for managing plugins, and it was allways a complete mess. Vundle has solved this for me completely.

Vundle also allows me to rapidly reconfigure my setup across multiple machines, which can be a real boost. It isn’t really a day-to-day productivity booster, but when you need it, it is great to have it configured.

## NERDTree

One of the first walls I hit was “how the heck do I navigate files in a project?”

The solution is multi-pronged, and starts with NERDTree. The NERD Tree is a filesystem explorer that looks something like this:

NERDTree

It opens to your current directory, and allows you to drill down into folders. This allows you to traverse your project and open files. It also has file management capabilities for creating, deleting, and other common tasks.

NERDTree is fantastic for hunting something down, but there are other tools that help solve this problem in different ways.

note: I was chastised a bit for this one on Hacker News. NERDTree is big, and you might have better luck with netrw as suggested. I plan on digging in to :h netrw to see if I can drop NERDTree off this list of (my) essentials.

## ctrlp

Full path fuzzy file, buffer, mru, tag, … finder for Vim.

ctrlp is rad. It really lets you fly around your project’s files. After a quick let g:ctrlp_map = '<c-p>' to map it to a hotkey, you are off to the races. It has different modes that allow you to jump to files, buffers, most recently used, as well as tags.

With no fault to ctrlp, I’ve had issues with tags and JavaScript. ctags is behind the times, and DoctorJS lost its maintainer. Tern looks to have some promise in this regard, and the VIM plugin is under heavy development. Having solid JS tags would turbo-charge ctrlp for me, so I’m paying close attention to ongoing development.

## Syntastic

scrooloose has several awesome VIM plugins, including NERDTree above. I also get a lot of mileage out of Syntastic. It is a simple linter that highlights problems with syntax in a file. It works on save, and provides meaningful feedback about warnings and errors.

## EasyMotion

Last, but in absolutely no way least, is the elegent EasyMotion. This plugin is all about navigating in the file you are currently editing.

EasyMotion

When activated with the word motion, EasyMotion assigns the first letter of every word after the cursor with a letter-based hotkey. After the first 26 letters are used up, it switches to capitals. Those soon change to sections that allow you to “drill in” and get very fine-grained movement across large distances in your file. As your finger muscles get trained, the motion really is easy.

This list isn’t exhaustive, by any means. I also have several “essential” plugins that I used specifically related to languages and file types that are common for me. Vundle is probably the most essential out of this list. It has been a huge help over the previous cut-n-paste horrid approach I’ve used in the past. Running :BundleUpdate and watching Vundle march down my installed plugin list, looking at the github repository for each plugin I’ve installed, and updating them without any hassle at all is hugely satisfying.

If you are interested, my dotfiles are stored here. They are an ongoing process, but there are some interesting things going on.

I’d love the hear about your essential VIM plugins. I’m always on the hunt for new and interesting additions to my workflow.

### SuperTab

Do all your insert-mode completion with Tab.

### ShowMarks

Visually shows the location of marks.
Marks are useful for jumping back and forth between interesting points in a buffer, but can be hard to keep track of without any way to see where you have placed them.  ShowMarks hopefully makes life easier by placing a sign in the leftmost column of the buffer.  The sign indicates the label of the mark and its location.
It can be toggled on and off and individual marks can be hidden(effectively removing them).

### SearchComplete

Provides tab completion while inside the “/” search

## Programmer

### Tag List

taglist.vim : Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc).
Requires the exuberant ctags utility.

### SQLComplete

Completion for the SQL language includes statements, functions, keywords, operators and database options which it draws from the current SQL syntax file in use.  Vim ships with 9 different SQL syntax files (Oracle, Informix, MySQL, SQL Anywhere, …).  You can choose different SQL dialects using the command  (see :h sql-dialects):

### The NERD Commenter

A plugin that allows for easy commenting of code for many (nearly all) filetypes.

### VCSCommand

VIM 7 plugin useful for manipulating files controlled by CVS, SVN, SVK and git within VIM, including committing changes and performing diffs using the vimdiff system.

### Surround

All about “surroundings”: parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, change and add such surroundings in pairs.

### 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 (as recognized by the syntax highlighting mechanism) intelligently.

### snippetsEMU

Attempts to emulate some of the behaviour of ‘Snippets’ from the OS X editor TextMate, in particular the variable bouncing and replacement behaviour.

## PHP

### Smarty Syntax File

Syntax file for Smarty, the template engine for PHP.

### PHP Syntax File

Syntax file for  PHP.

### PHP Folding

This script can fold PHP functions and/or classes, properties with their PhpDoc,
without manually adding marker style folds ({{{ and }}}).

### CheckSyntax

Check syntax when saving a file (PHP). Also supports ruby, tex, etc.

### PDV- phpDocumentor for Vim

Provides really comfortable generation of phpDocumentor doc blocks for PHP

Top Down