In its 22 years of existence, the Vim editor has become the center of an ecosystem of plugins. Whether you are coding or writing a text document, you can probably find a plugin that will make you more productive.
If you're coding in a specific programming language, you can find multiple plugins that will customize Vim to transform it into a dedicated editor for your language, but you don't have to be so specialized to benefit from many Vim plugins. Consider the following.
The more plugins you use in Vim, the harder it is to keep them updated or delete them. A number of plugin managers for Vim can help. The oldest and most popular, Pathogen, simplifies plugin management by requiring that each plugin have its own subdirectory. It is popular among those who prefer to manage plugins for themselves, but appreciate having a tool that simplifies the process.
Vundle ("Vim bUndle") uses the same directory structure as Pathogen, but takes the additional step of requiring modifications to the .vimrc directory in order to allow automatic updates and provide the ability to turn off a plugin without actually deleting it.
Switching from Vim to a file manager can break your concentration, especially if you are working in a maximized terminal. NERDTree solves the problem by adding a directory tree in a separate pane inside Vim. The tree highlights files, directories, symbolic links, read-only files, and binaries in different colors for easy identification. You can also bookmark files so that you can jump directly to them.
When you start NERDTree with the command :NERDTree, it shows the current directory. If you prefer, you can specify a directory or a bookmarked file as the starting point instead by adding its path to the end of the commandYou can also use the command :NERDTreeFind [String]. to search for a specific file and jump to it.
If you like the idea of having a file manager within Vim but don't love NERDTree, you have other options. Easytree, for instance, has fewer features, while Vimpanel and wimanager have more.
"Yank" is Vim's term for copying or cutting and pasting. A yankring is a retrievable history of yanks, similar to the one provided by Klipper on the KDE desktop.
By default, Vim stores the last nine yanks. However, with the YankRing plugin, you can reconfigure Vim to store more or fewer. Even more importantly, YankRing allows you to copy or cut in a separate pane or with a series of commands that give you the choice of yanking everything from the current word or line to a range of lines. If you store the ring in a file, you can use it with multiple instances of Vim, which may be especially handy on a network.
Surround is useful with many programming languages because it deals with delimiters – characters that appear in pairs to define a string, such as quotation marks, brackets, parentheses, and complete tags in markup languages like HTML and XML. Surround adds, deletes, and replaces delimiters via a series of keyboard commands.
If you want to compare Surround with similar alternatives, closetag and ragtag offer something of the same functionality, specifically for markup languages.
Marks are bookmarks within a Vim document. You can set a mark by pressing m followed by another letter that designates the mark. To jump to a mark, enter ' followed by the mark's letter.
The great weakness of marks is that they are invisible. This limits the number you can use to however many you can remember, and you can easily accidentally overwrite an existing mark by creating another with the same name.
Showmarks allows you to toggle the visibility of marks off and on – and that tiny functionality is enough to increase the usefulness of marks several times over.
NERD-commenter is a general-purpose plugin designed for writing code or using markup languages. Even if you are not writing code or markup, comments are still helpful when you're collaborating with others on a document. You may also find comments more convenient than storing thoughts in a separate buffer, as the Notes plugin does.
NERD-commenter installs with a series of keyboard shortcuts for adding and removing comments based on various selections of words or lines or of cursor position. It supports nested comments, the use of alternate delimiters to mark comments, and selecting the positioning of delimiters.
Vim-abolish is so elegant that you wonder why no one thought of it before, but it's hard to describe. It has aspects of a word processor's spell checker or autocorrect, but might best be described as a configurable search and replace tool. What makes Vim-abolish so powerful is that it allows you not only to search and replace one word or spelling for another, but also to include all instances of a word. Upper case, lower case, noun and adverb, past and present tense, participles – all can be added to the search and replaced with a few dozen characters.
Admittedly, you might take a while to learn how to think in the terms necessary to set up a Vim-abolish command, and learning how to construct a command may take some time too. However, once you understand how Vim-abolish works, you will probably find it an invaluable proofreading tool.
VimOutliner is exactly what its name suggests: a way to create hierarchial outlines. It is so popular that most major distributions package it, but you must add two lines to your .vimrc file before you can use it:
filetype plugin indent on
Once you have VimOutliner up and running, creating a new level is as simple as starting a new line with an additional indent and adding a heading. Start a line below a heading with a colon (:), and text will be wrapped automatically and formatted when you export the current document to another format; start a line with a semicolon (;) and you can insert a line break. You can also collapse or open outline levels as useful, with everything color-coded for convenience.
You can save a VimOutiner document to a file with an .otl extension. However, VimOutliner also includes a series of Python scripts to save to awk, PDF, DocBook, HTML, and LibreOffice Impress formats – the latter presumably chosen because its Outline view is the best outline tool available in the office suite.
Vim supports powerful undo functionality that tracks not only changes, but branches of changes. However, good luck finding a particular change with vanilla Vim so you can revert to it. If you don't want to simply revert one step at a time until you find what you are looking for, you can try to jump according to your best guess as to the time the change was made. Of course, if you guess wrong, or fail to keep track of what branch you are on, you are more likely to be confused than successful.
Gundo eliminates this confusion with a text-based representation of the undo tree and a few simple tools for navigation. At all times, you know exactly where in the undo tree you are, and that allows the undo functions to really come into their own.
Add a few of these plugins, and functionally Vim soon begins to rival a word processor. However, no matter how many plugins you add, Vim is never going to match the convenience of an office suite, even if you use GUI-Vim. Some of these plugins include a lengthy list of keyboard commands that take practice and repeated use to master. However, the control and power they offer makes the effort worthwhile, especially if you work regularly without a display manager.
Allowed tags: <a> link, <b> bold, <i> italics