Custom CSS

Saturday, October 23, 2010

Installing VimClojure 2.2.0

I spent a good morning trying to figure out how to set this darned thing up so I could write some Clojure, so I'm sure as hell going to document it in case somebody else wants to know (or I get one of those mind erasing kits and forget how to do this)!

Install the VimClojure plugin

  1. Download the VimClojure script here.
  2. Unzip in your ~/.vim directory, but take the files in the bin directory and put them in your PATH (in particular, you'll want the ng-server script).
  3. Add the following to your ~/.vimrc: let vimclojure#WantNailgun = 1

Install the VimClojure Nailgun client

  1. Download the appropriate sources for VimClojure 2.2.0; they are located here.
  2. Unzip the sources and enter the vimclojure-nailgun-client directory.
  3. Run make and move the generated binary into your PATH.

Install the VimClojure Nailgun server

You can get these from Clojars using Leiningen or Maven. For example, if you run lein deps on a simple project like the one below, it will download the VimClojure server:

(defproject vimclojure-test "1.0.0-SNAPSHOT"     
  :dependencies [[org.clojure/clojure "1.2.0"] [org.clojure/clojure-contrib "1.2.0"]]
  :dev-dependencies [[vimclojure/server "2.2.0"]])

Set up your environment to run the Nailgun server

Export the following environment variables, telling the ng-server script where to find the server, Clojure, and the contrib libraries. Here's what mine looks like:

export CLOJURE_EXT=/opt/clojure:/opt/clojure-contrib/target:$M2_REPO/vimclojure/server/2.2.0

Run the server and start Vim

Finally, you can run the ng-server script, and write some Clojure with Vim!