Search
Categories
Navigation
Twitter Updates

Twitter Updates

    follow me on Twitter

    Entries in vim (1)

    Tuesday
    May312011

    Extending Janus with runtimepath

    Complex machinery; photo by Telstar Logistics (Flickr)

    TL;DR

    You can easily extend Janus by using Vim's runtimepath setting in your .[g]vimrc.local file.

    Setting the Scene

    About six months ago, I switched from using Textmate to Vim as my primary text editor. At first, I tried configuring things on my own, reading through Learning the vi and Vim Editors, but it was slow going (yes, I read the whole thing).

    Needless to say, things went a lot faster after I discovered Janus, the much-discussed Macvim starter kit from Yehuda Katz and Carl Lerche. Many thanks to those fine gentlemen.

    Having My Cake

    After using Macvim with Janus a while, I needed to customize Vim a bit more, mainly to install a few additional language syntaxes, tweak indentation rules and add color schemes. Janus already has support for some level of local customization, by sourcing the ~/.[g]vimrc.local file, where you can set additional options and overrides. More recently, they added support for installing additional Vim plugins using ~/.janus.rake and vim_plugin_task with a git source location. Both approaches are described in the Janus readme.

    This gets you pretty far, but sometimes I just want to dump some Vim scripts in a directory. Dropping files directly in ~/.vim (where Janus is installed) gets messy since it's a git repository and I don't want to mix up what is installed by Janus and what isn't.

    I wanted my own sandbox that played nicely with Janus but lived outside its domain.

    And Eating It Too

    My solution is the runtimepath setting, which defines a "list of directories which will be searched for runtime files." Armed with this, I extended Janus following these steps:

    1. Add a ~/.vim.local directory
    2. Add any necessary subdirectories to ~/.vim.local and drop Vim scripts inside appropriately (e.g., ~/.vim.local/colors/myniftycolorscheme.vim)
    3. Add set runtimepath+=~/.vim.local inside my ~/.vimrc.local file, which Janus already sources

    You can see my current settings in vimrc.local and vim.local/ from my dotfiles repo.