My configuration file is always changing. Vim is so flexible and powerfull, and the plugin authors so productive, that from time to time I spent a few hours looking for new plugins and tricks and retuning my configuration file. In this article I will comment the coolest plugins I use trying to explain why I find them to be so good.
(Note: click on the images to see the full size)
- Created by: kien
- Get it from: http://kien.github.com/ctrlp.vim
- Summary: fuzzy incremental search on buffers, recently used files, files, tags...
If like me you usually work with projects that involve involve working with lots of different source code files this script provides an incredibly productivity boost. Once you have assigned your shortcuts to the different functions, you will be able to search with an incremental search (results are being removed as you write) for:
- Files in the 'root' directory or any subdirectory
- Open buffers
- Recently used files
As described it doesn't sound like much, but it's incredible how much time this plugin will save from the old methods of searching for files with some file explorer (inside or outside Vim), or looking at a buffer list and changing to a specific buffer with the keyboard or by a number. I used Vim sessions a lot (done with :mksession [file]) but you always ended having to open (and painfully search) for more files. With this you just press the shortcut, start to write part of the name of the file or buffer you want to open, and in a few keypresses you will have it opened. You have to try it. And combined with the Project plugin I'll comment on the next section for opening the files that you don't have in your MRU list, the productivity boost is just absurd
The modes I mostly use are "MRU" or "CtrlPMRUFiles" (most recently used) and Buffers (CtrlPBuffer). The "files" mode (CtrlP) is useful if all your project files have a common root, which is usually the case with my personal projects but not with my projects at work because I usually have files from non coupled different libraries in different directories, RPC definitions, etc, and setting the parent directory of all these projects as root would slow too much the file mode search. I sometimes also use the CtrlPBufTagAll command that (when you have exuberant ctags installed) allows you to search in the symbols of all the open buffers.
The MRU search mode can sometimes also be slow to open when you have lots of recent files (as you will once some time has passed since you start to use the plugin). I fixed this problem by enabling some catching options that CtrlP has.
Ctrlp has made me stop to use (and remove) several Vim plugins I had installed (but were worse) for the MRU, buffer explorers and files functionalities. Also, since switching buffers is so convenient now, I've mostly stopped using tabs.
- Created by: Aric Blumer
- Get it from: http://www.vim.org/scripts/script.php?script_id=69
- Summary: Adds a sidebar where you can add foldable projects
If you've used some graphical IDE like Visual Studio or Eclipse you surely have seen the typical "Project" sidebar with expandable directories with list of files inside. These sidebars are very useful when you want to keep all the files in the project logically grouped and just one or two clicks away. We, superior and condescendent Vim people don't do clicks, but that doesn't mean that we can find some ideas from IDEs interesting.
The Project Vim plugin provides exactly that, a sidebar where you can see all the source code (or related) files grouped in folds by directory, and you only have to move the cursor to the file and press the Intro key to open it as a buffer. After reading the previous section you can think that a plugin like CtrlP makes these kind of sidebars obsolete, but while it's true that I've been using my Project shortcut much less since I use CtrlP, its still very useful because it allows you to open all the files from a project or part of it quickly when you are starting to work on it (using "\l" when over the fold), grepping only over the project files (\G). Also, you can keep as many projects as you want in the sidebar. It's also very useful if like me you sometimes want to open several files from different (but related) projects.
Project.vim has a lot of features so I recommend you to take a look to the documentation before using it.
- Created by: Jan Larres
- Get it from: http://www.vim.org/scripts/script.php?script_id=3465
- Summary: Adds a sidebar with the current buffer symbols
TagBar provides another typical feature from graphical IDEs which usually have a sidebar were you can see the project symbols organized in a tree (classes, methods, functions, variables, etc). This is not only useful to jump to a symbol quickly, but also allows you to have an overview of the internal logical structure of the source file.
TagBar provides exactly that, a browsable tree of symbols that you can jump to just moving the cursor over one of them and pressing Intro. As happens with other plugins, CtrlP has reduced the number of times I use this plugin because now I use CtrlPBufTagAll to search and jump to a particular tag, but sometimes it's nice to see the symbols of the file in a tree to have an overview of the file (specially if you didn't write it) and to remember some symbol whose name you just forgot (CtrlP can't help you in that case).
- Created by: Michael Sanders
- Get it from: http://www.vim.org/scripts/script.php?script_id=2540
- Summary: Quickly adds some common snippets of text
SnipMate is a feature taken from TextMate. The idea is simple, you write some bit of text and press the Tab key and the editor autocompletes that to a full snippet.
For example, to write a class in Python you would write "cl", press tab, and it would be completed to:
class ClassName(object): """docstring for ClassName""" def __init__(self, arg): super(ClassName, self).__init__() self.arg = arg
Now, pressing Tab again will make the cursor move to the different "variable" parts of the snippet so you can write them; in the class example the parts would be the ClassName, object, docstring, init arguments and super() call.
SnipMate includes several snippets for some programming languages and some common ones, but it's very easy to define new snippets.
- Created by: Kim Silkebækken
- Get it from: http://www.vim.org/scripts/script.php?script_id=3881
- Summary: Much better status bar
Powerline improves Vim status bar with colors that change depending on the active mode (and for some plugins like CtrlP and Tagbar) and also reorganizes the information in a much more intuitive way. Also, if you patch the fonts (with an included script) it will use some pseudographical characters to make a clearer the distinction between the different bits of information (see the screenshot). The font patching, unfortunately, only seem to work in Linux and Mac (please correct me in the comments if I'm wrong).
- Created by: Marty Grenfell
- Get it from: http://www.vim.org/scripts/script.php?script_id=1218
- Summary: Easily comment code in almost any language
Nerd Commenter allow you to comment or uncomment lines or sections of code (previously selected in visual mode in the cases sections). This doesn't sound remarkable, but the things is that Nerd Commenter understand lots of different programming languages and the way commenting is done in every one. With some languages like HTML, XML or Django templates this is a real time saver.
- Created by: David Fishburn
- Get it from: http://www.vim.org/scripts/script.php?script_id=1234
- Summary: Easily select any previously yanked register
This plugin improves Vim's copy-and-paste system (aka yanking) with an easy to use "clipboard" where you can easily select a configurable number of past registers (saved text). Since Vim automatically puts the text you delete in the clipboard sometimes what you paste is not what you were expecting. This plugin avoid this problem, letting you paste exactly what you want. It's like an overpowered version of the :registers command.