Using Clojure with VIm


Overview


Using Vim and Clojure

I just recently discovered Clojure, a Lisp-dialect that creates code on a Java-Virtual machine.
Being far from esoteric, Clojure is highly usable, and combines the advantages of a functional programming language with the widespreadedness of Java. Clojure is 100% compatible to Java, so you can include any java object you want into your Clojure code, without having to code a single line in Java!

Since Clojure is descendant of LISP, it is sensible to assume, that the editor of choice for this would be EMACS, which is written in LISP itself. But while some people literally worship it, others prefer it's great rival, VIm. VI has been around almost as long as there is Unix, and it was the first editor I used, when I got my hands on a Unix-like OS. And I still use it, and don't wanna miss it.

Luckily, I'm not the only one, so some people have created a set of tools, to embed clojure into the vim environment. There are several tools I use for programming in closure:

Installing the tools

Since I use archlinux, I can install most of the stuff I need, through the AUR. That's easiest with yaourt.
yaourt -S vim-pathogen


This will install and configure the pathpgen tool. Next in line is rainbow_paranthesis
yaourt -S vim-rainbow


Now add the following to your ~/.vimrc:
" Use rainbow paranthesis
let g:rainbow_active = 1
let g:rainbow_operators = 1


Keep in mind, that rainbow paranthesis might not work in gvim with any colour scheme. If it doesn't work, try another colour scheme first.

The other packages are sady not in the AUR yet, but pathogen makes installing them easy
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-foreplay.git
git clone git://github.com/tpope/vim-classpath.git
git clone git://github.com/guns/vim-clojure-static.git


Now we need to generate the helptags. I did this by calling
:helptags ~/.vim/bundle/vim-forplay/doc
:helptags ~/.vim/bundle/vim-classpath/doc
:helptags ~/.vim/bundle/vim-clojure-static/doc


And there you go, that's basically all you need. You can now use the functions of the plugins to customize your .vimrc.



There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki