Digging Deeper With Vim
In my previous article introducing the basic mechanics of Vim, I briefly mentioned some of the more advanced capabilities. The last article was intended to give the reader a cursory introduction, and leave them with the ability to be competent in editing files with Vim. Today, we are going to buckle down and get into what makes Vim the best text editor on the planet. Let’s talk plugins.
The core functionality of Vim can be extended by adding plugins. While not strictly necessary, plugins significantly raise the bar for what a text editor, or even a word processor, must be capable of before it can be compared to Vim. Everyone’s recipe is a little different, there are so many plugins that getting just the right mix to configure Vim the way you like it can be a bit tricky, but I will go over how I use it, and what works out best for me.
- Pathogen is a meta-plugin of sorts. This should be the first plugin installed, as it allows you to install the other plugins easily and keep them nicely contained inside of a “bundle” directory. Installation and further explanations are available in the readme.
- I primarily use Vim for writing, almost exclusivly in Markdown, and when posting links I do not always want to jump back to Firefox to find the link, especially when I know that the link I’m looking for is going to be the first result in Google. Autolink allows me to put brackets around a word, enter normal mode, and press “,al”. The autolink plugin will search Blekko, and return the link for the first result.
- When working on a project with several files, it is helpful to be able to switch between them quickly. Command-T is the fastest way to jump between files that I know of. This one is better seen in action than explained, so check out a few of the screencasts here, before installing.
- Gundo is undo on steroids. Vim keeps a complex tree of undo versions to the file that you are working on, and Gundo allows you to navigate the previous versions. Again, probably worth checking the screencast here
- One of the advantages of writing in plain text is that you can easily add notes to yourself in the file that do not show up in the finished document. Nerdcommenter, whose name I despise, but usefulness I love, let’s me create a quick keyboard shortcut to add these notes.
- Allows me to use tab to auto complete words.
- Quick and easy formatting of tables, or columnar data.
- Ultisnips allows you to create snippets of text that expand when you type them. For example, I could type “sec” and it would automatically expand to # Section Name #. However, that’s not all it can do. You can also use Python to run nearly any script imaginable to transform your text. It is definitely worth checking out the screencasts on this one, especially the fourth, which covers Python.
- If you stare at text all day, it makes sense to try to make it as easy on your eyes as possible. I appreciate the work that Ethan Schoonover has done on Solarized.
- As previously stated, I write most everything in Markdown, this plugin does some nice syntax highlighting.
- I don’t always use outlines, but when I do, I do them in Vim with vimoutliner.
I should note that a large portion of my current writing workflow has been influenced by Seth Brown and his site, Dr. Bunsen. I also use his formd tool to write using inline markdown links, but convert them to reference links after the article is finished. I find reference links easier to read, but inline osier to write.
My Vim setup is optimized for writing, but you can set it up for any text project you need. Vim can be extended to a full blown “IDE”, complete with unit tests and syntax checking, or it can be as simple and bare bones as you need. Vim is powerful, well supported, mature, and set to keep going strong into the future.