21 Jan ’09

Easily installing clojure and vimclojure using leiningen


These are the steps I follow to install a local working environment (as you can guess this post is more as a mental note for me, so I can remember what I have done).



Make a local bin directory.
mkdir ~/bin
cd ~/bin

Get Leiningen, and self-install it.
wget http://github.com/technomancy/leiningen/raw/stable/bin/lein
chmod +x lein
lein self-install

Make a project directory, for example 'eden-3'
mkdir ~/eden-3
cd ~/eden-3

Make a project.clj file in ~/eden-3, detailing the dependencies

(defproject eden-3 "1.0.0"
:description "My own project"
:dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"]
[org.clojure/clojure-contrib "1.0-SNAPSHOT"]
[dk.brics.automaton/automaton "1.11.2"]]
:dev-dependencies [[org.clojars.ato/nailgun "0.7.1"]
[org.clojars/gilbertl/vimclojure "2.1.2"]]
:main eden)


Make a src directory in ~/eden-3, and write the sourcecode of eden.clj in that directory

(import '(dk.brics.automaton Automaton RunAutomaton RegExp))
(RegExp. "[123][12][13]")


Auto-install the dependencies, as specified in project.clj
cd ~/eden-3
lein deps

Unpack the nailgun client and vimclojure vim scripts somewhere, and manually install them
mkdir ~/temp
cd ~/temp
wget http://www.vim.org/scripts/download_script.php?src_id=11066
unzip vimclojure-2.1.2.zip
cd vimclojure-2.1.2
mkdir ~/.vim
cp -r autoload ~/.vim
cp -r doc ~/.vim
cp -r ftdetect ~/.vim
cp -r ftplugin ~/.vim
cp -r indent ~/.vim
cp -r syntax ~/.vim
cd ngclient
make ng
cp ng ~/bin

Setup your .vimrc

set nocompatible
filetype plugin indent on
syntax on

let maplocalleader = ","

let g:clj_highlight_builtins = 1
let g:clj_highlight_contrib = 1
let g:clj_paren_rainbow = 0
let g:clj_want_gorilla = 1

let vimclojure#NailgunClient = "/path/to/your/ng"

set number
set hidden
set showmode
set bs=2


And you're ready to go. Just fire up the nailgun server manually, open the sourcecode in vim, and launch a repl with ",sr"
cd ~/eden-3
java -server -cp 'src:classes:lib/*' com.martiansoftware.nailgun.NGServer 127.0.0.1 &
vim src/eden.clj

Done!

Comments






Back to Bag of Souls
Me