Started the process of getting jiggy with Clojure at work and didn’t like the idea of using Eclipse for my day to day work… so I started looking at how to make vim and clojure get along and came across a great post! Here are the distilled notes plus minor tweaks to get anyone out there trying to do the same thing going:
- Download VimClojure (http://www.vim.org/scripts/script.php?script_id=2501)
- Download VimSlime (https://github.com/jpalardy/vim-slime)
- Extract these files into your ~/.vim folder
- Add the following lines to ~/.vimrc:
- " Settings for VimClojure
- let vimclojure#HighlightBuiltins = 1
- let vimclojure#ParenRainbow = 1
- " Send entire file to repl
- nmap <C-m> ggVG<C-c><C-c>
- Start a repl session inside screen:
- screen -S clojure
- lein repl
- Open a clojure file with vim and highlight the method you want to evaluate
- Press ctrl + c twice
- For session name prompt, enter ‘clojure’ which is the name of the screen session
- For window name prompt, accept the default number displayed
- The selected code should be evaluated in the screen session
- Press ctrl + c, v to get prompt again
NOTES:
- I chose to start a repl using lein but you can use whatever you’re familar with to get a repl started
- I have lein inside a directory in my Dropbox as well as all of my vim files and plugins. I then created soft links to them in my $HOME directory which makes this whole thing very easy to access from different systems as long as Dropbox is installed :)