Vim Scripts

Someone recently asked me what Vim scripts and plug-ins I use on my Vim setup. There are literally hundreds of plug-ins on the Vim site, some of them quite complex and interesting.

Though I've customized my own Vim setup quite a bit, I don't use all that many plug-ins. Here's what I normally use:

Plug-Ins

  • Calendar: Displays a calendar in a Vim buffer. Though not as complete as the functionality in Emac's calendar, it is still pretty useful :-).
  • Camelcasemotion: This one adds word-movement navigation motions that are aware of the casing of characters inside words. So, for example, if you're at the beginning of "newIdentifier" and press ",w", you'll navigate to the 'I' instead of to the end of the complete word like with "w".
    This is one of the features I missed the most from Eclipse. Unlike Eclipse, though, I rather like how with Camelcasemotion I can keep both behaviors at the same time.
  • NumberMarksNumber Marks:  Allows you to define numbered marks that behave a lot more like bookmarks in Visual Studio (you can even navigate them using F2!). The nice part about this one is that it will show the mark in a column to the left of the text, unlike regular Vim marks which are hidden.

    While on the topic of marks, there's also ShowMarks, which solves the issue of the hidden Vim marks: It also adds a new column at the left of the editing window showing which marks have been defined and where in the current document. It does its job, but I've found it to be more intrusive than Number Marks and it also seems to cause some issues with a few other plug-ins at times, which is why I don't like it as much.

  • NERD_Tree: Provides a "side pane" for browsing the file system and opening files within Vim, which is sometimes better than simply opening up a directory in the main buffer. I've hooked it up so that Ctrl+E,Ctrl+E pops up the tree.

    NerdTree
  • Obvious Mode: Great little plug-in recently released that highlights the status bar in a different color when you're in insert mode. This is particularly useful for me when working on the console version of Vim (which I do every so often) because I don't normally get the block-vs-line cursor difference that's common in GVim.
  • VimExplorer: For more complex file browsing and file manipulation options, I also use VimExplorer occasionally. This is more like Windows Explorer embedded inside Vim [screenshot], so it is a lot more complex than NERD_Tree, and has a lot more options. I use it a lot less, but it's still pretty useful.
  • Xmledit: Makes editing XML files in Vim a bit nicer, adding things like automatic insertion of closing tags.
  • Xmlpretty: Helps in doing a basic pretty print formatting of XML files. It's not very sophisticated, but it's occasionally useful. The downside of Xmlpretty is that it requires a bit more work to setup than other scripts since it doesn't configure itself automatically. I bound it to Ctrl+K, Ctrl+F.
  • Cream: Cream is sort of an alternate, highly customized distribution of Vim that makes it behave more like "normal" text editors (particularly for Windows users). I don't use Cream per-se, but I've occasionally plucked some functions from the cream source for my own Vim setup. In particular, I use Cream's functions for tab-ifying lines of text in select mode.

Syntax and Others

Besides the built-in syntax, indent and file type plug-ins that come with the Vim runtime, I use a few other ones:

  • CssColorCSS Color:  Cool little plug-in that highlights color specifications in CSS with the color they represent. I've found this particularly useful when modifying or inspecting an existing CSS file.
  • PS1: I use slightly modified versions of Peter Provost's indent, syntax and file type plug-ins to edit Windows PowerShell scripts.
  • CSharp: A slightly modified version of the Built-in cs.vim syntax file. It's ok, but could use a bunch of improvements, I mostly just browse C# code on Vim, though, so it's not that big of a deal.

Color Schemes

Like with Visual Studio, I change the color schemes I use in Vim every so often. Here are some of the ones I use the most:

  • Moria: A nice color scheme for Vim featuring versions with both dark and black background colors. Lately I've been using the version with the black background more (:Colo Black).
  • Twilight: This is another dark color scheme, with some some khaki/gold highlights. It works particularly well for source code from scripting languages like Ruby, PowerShell or Python, though not as well for C# and Java code. For some reason, however, this looks a lot better on my Ubuntu machine than on my Windows one (something to do with gamma correction I'm sure).
  • Wombat: I've talked about wombat before. Lately I haven't been in love with it so much and have switched to some of the other ones.
  • Zenburn: This is an old time favorite of many Vim users, and it's a really nice color scheme. I've been using this one a lot more lately, as it has fairly soothing colors, without being so low-contrast that it becomes harder to use with the LCD brightness turned down.
    I use Zenburn with the "zenburn_high_Contrast" option enabled, though, which makes the background slightly darker than what this screenshot shows.
    The CSS I'm using to highlight my code samples in this blog lately is Zenburn.
  • DarkSpectrum: This one I've been using lately as well. It features a darkish gray background with blue/gold/orange/green highlights and some bold white for keywords and such [screenshot]. It doesn't work as well for some languages, most notably Vim scripts themselves, though.
  • Impact: This is the one I use for console vim, as it works better with the limited color palette available there (partic ularly on windows).
Technorati tags:

3 comments

  1. Wow, thanks so much for these! I honestly can see myself using 90% of these… Some, for example the file browser and number mark I have been meaning to find but haven’t had the time to dig around for plugins. And I can’t wait to try out that CSS syntax for my next stylesheet.
    Thanks again, and keep up the great posts!
    - Jason
    "Go Vim! Woohoo!"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>