How I develop Clojure with Vim
writequit.org
writequit.org
I really hope that a real shell gets implemented inside vim at some point, it's almost enough to make one switch to Emacs.
The patch is here: http://www.wana.at/vimshell/
I do, however, encourage everyone to try out the different options to find what works for them, what works for me doesn't work for everyone. Conque is a really neat plugin, it's definitely worth a shot for people shopping around.
So, the value is as a visual aid - just like any syntax highlighting, highlighting matching parentheses when the cursor is over them, line numbers etc. Non of these things are strictly needed, but they help us comprehend code more easily and quickly.
The only thing I wish I had was a paredit like mode, but you can't have everything!
I use AutoClose.vim and Surround.vim to deal with most pairwise operations. The only major tweak I make is to rebind s to work as 'surround':
""s/S is pretty useless. :help text-objects
nmap s <Nop>
nmap sw viwS
nmap sW viWS
nmap ss visS
nmap sp vipS
nmap s[ vi[S
nmap s] vi]S
nmap s( vi(S
nmap s) vi)S
nmap s{ vi{S
nmap s} vi}S
nmap s< vi<S
nmap s> vi>S
nmap st vitS
nmap s' vi'S
nmap s" vi"S
nmap s` vi`S
nmap S <Nop>
nmap Sw vawS
nmap SW vaWS
nmap Ss vasS
nmap Sp vapS
nmap S[ va[S
nmap S] va]S
nmap S( va(S
nmap S) va)S
nmap S{ va{S
nmap S} va}S
nmap S< va<S
nmap S> va>S
nmap St vatS
nmap S' va'S
nmap S" va"S
nmap S` va`S
This allows you to do things like wrap the current s-expr in another using S))a.I also rebind all the vimclojure keys because I hate the defaults (e.g. I use \e to eval, K to lookup docs, and ctrl-] to jump to definition).
EDIT: I created slightly different bindings. These are a bit longer, but have the same power, flexibility, and use of the documented text-object motions.
" Remap s/S to surround operations
" :help text-objects
nmap s <Nop>
nmap S <Nop>
" Surround inner (si)
nmap siw viws
nmap siW viWs
nmap siss viss
nmap sip vips
nmap si[ vi[s
nmap si] vi]s
nmap si( vi(s
nmap si) vi)s
nmap si{ vi{s
nmap si} vi}s
nmap si< vi<s
nmap si> vi>s
nmap sit vits
nmap si' vi's
nmap si" vi"s
nmap si` vi`s
" Surround inner on new lines (Si)
nmap Siw viwS
nmap SiW viWS
nmap Siss visS
nmap Sip vipS
nmap Si[ vi[S
nmap Si] vi]S
nmap Si( vi(S
nmap Si) vi)S
nmap Si{ vi{S
nmap Si} vi}S
nmap Si< vi<S
nmap Si> vi>S
nmap Sit vitS
nmap Si' vi'S
nmap Si" vi"S
nmap Si` vi`S
" Surround an object on same lines (sa)
nmap saw vaws
nmap saW vaWs
nmap sas vass
nmap sap vaps
nmap sa[ va[s
nmap sa] va]s
nmap sa( va(s
nmap sa) va)s
nmap sa{ va{s
nmap sa} va}s
nmap sa< va<s
nmap sa> va>s
nmap sat vats
nmap sa' va's
nmap sa" va"s
nmap sa` va`s
" Surround an object on new lines (Sa)
nmap Saw vawS
nmap SaW vaWS
nmap Sas vasS
nmap Sap vapS
nmap Sa[ va[S
nmap Sa] va]S
nmap Sa( va(S
nmap Sa) va)S
nmap Sa{ va{S
nmap Sa} va}S
nmap Sa< va<S
nmap Sa> va>S
nmap Sat vatS
nmap Sa' va'S
nmap Sa" va"S
nmap Sa` va`S nmap s ys
nmap S yS nmap s ysi
nmap S ysaDon't let Emacs stop you. Happy hacking.
Use whatever editor you are comfortable with. Learning a new language with an editor getting in your way is pretty hard.
Outside emacs, I agree with swannodette. Enclojure (NetBeans) has the most complete support for Clojure.
http://nullstyle.com/2008/11/09/ann-clojure-textmate-bundle-...
Works well, though it contains its own clojure install, which may not be ideal. It looks fairly hackable though.
If you do install it, you have to edit a project (folder) in TextMate, otherwise starting the repl will fail. Minor wrinkle.
update: Argh! My eyes!
http://stackoverflow.com/questions/2413047/can-emacs-color-d...
seems to me like the best solution so far. It only applies "rainbow parens" to the parentheses and parents parentheses of the s-expressions at the cursor.
M-x gdb
Screenshot: http://www.gnu.org/software/emacs/tour/images/gdb.pngIf you want to debug a Lisp, you can't do better than Slime. Not sure what the state of the art is on Clojure debuggers.
For a development paltform that's neither brittle nor toy.
Offhand, the only feature I can think of that eclipse has that vim doesn't is the ability to display images and graphs - all the normal editing features (auto completion, code folding, syntax highlighting, integrated debugger, file browser, plugin system, remote editing, integrated repl, multiple editor buffers, compile&run function, etc etc) can be enabled pretty easily. Also, you can run vim and emacs over ssh - cant do that with eclipse or visual studio :)
Really, vim and emacs are full blown IDEs with all the features you'd expect from a modern IDE - except it doesn't use a fancy GUI.