5 ms·
How I develop Clojure with Vim
- swannodette 17y agoContrary to popular belief (and my own personal preference ;), you can hack Clojure from Vim, Intellij, Eclipse, and Netbeans (the most full-featured at the moment besides Emacs). Don't let Emacs stop you. Happy hacking.
- raju 17y agoAgreed. I see a lot of tweets from people trying to decide on the best editor or IDE for Clojure. Personally, I use Clojure (in all honesty I am just dabbling in it and haven't used it on a full-blown project) but IMO to a large extent - it does not matter. 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.
- watmough 17y agoFor those on Macs, there's a TextMate bundle here: http://nullstyle.com/2008/11/09/ann-clojure-textmate-bundle-01/ 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.
- swannodette 17y agoDevelopment by nullstyle on that stopped in 2008. Clojure wasn't even 1.0 at the time. However looking here, http://github.com/nullstyle/clojure-tmbundle/network http://github.com/nullstyle/clojure-tmbundle/network, shows that development is alive and kicking, hopefully one of these becomes the new official release.
- greyhat 17y agoUpvoted for rainbow parentheses, which I just added to my .emacs =D
- twism 17y agoDo you mind showing us how? I googled everywhere and only came up with a highlight-parentheses minor mode hack which only highlights the parentheses at the cursor.
- twism 17y agoFound it... http://dishevelled.net/elisp/rainbow-parens.el http://dishevelled.net/elisp/rainbow-parens.el update: Argh! My eyes!
- avigesaa 17y agoIf you're interested in taking things in the opposite direction, try reducing the prominence of parentheses via ParenFace (http://www.emacswiki.org/emacs-en/ParenFace http://www.emacswiki.org/emacs-en/ParenFace). I use a very light gray face for parentheses, which is barely visible on a white background.
- twism 17y agohighlight-parentheses minor mode hack which is found here http://stackoverflow.com/questions/2413047/can-emacs-color-different-levels-of-matching-parentheses-with-a-rainbow-of-differ 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.
- Kototama 17y agoI tried this mode today and it makes searching and editing terribly slow, even on a relative small file (~700 lines).
- gfodor 17y agoI just started using Clojure this weekend with Vim. I am not sure why the author of this post didn't use VimClojure with Nailgun, but it works seamlessly and lets you have rich-SLIME like interaction with a REPL. The only thing I wish I had was a paredit like mode, but you can't have everything!
- grayrest 17y agoIf you know about vim text objects and f/t motion, there isn't much that paredit mode can do that vim text objects don't. E.g f) is the equivalent to paredit-forward while ci( is 'replace contents of s-expr' and da[ would be 'delete vector'. 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).
- snprbob86 17y agoDude! Thank you so much. I was trying to figure out what magic incantation I needed to find the docs for "inner", etc. :help text-objects did the trick and I would have never considered remapping the s/S keys, which are agreeably pretty useless. 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
- pan69 17y agoI was wondering, and please forgive my ignorance, how do you debug with vi(m) or emacs? They are just text editors, right? Or am I missing something here...
- tsally 17y agoM-x gdb Screenshot: http://www.gnu.org/software/emacs/tour/images/gdb.png http://www.gnu.org/software/emacs/tour/images/gdb.png If 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.
- dkersten 17y agoVim and emacs are just text editors in the same sense that visual studio, eclipse, netbeans and so forth are just text editors. 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.
- jrockway 17y agoWhat's the value in rainbow parentheses? I have coded Lisp for years, and have never wondered where I need to add parens; it's intrinsic in the structure of the code. Braces are the same way -- you know when you have the right number. No need for gaudy colors just because nested parentheses are new to you...
- dkersten 17y agoYou don't need them, but I do find them extremely useful for at a glance parentheses matching, especially if the expressions span multiple lines. 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.
- jcw 17y agoUsing screen to get a REPL alongside vim is pretty clunky. Conque is much easier, in my opinion: http://www.vim.org/scripts/script.php?script_id=2771 http://www.vim.org/scripts/script.php?script_id=2771 I really hope that a real shell gets implemented inside vim at some point, it's almost enough to make one switch to Emacs.
- mhansen 17y agoYou can compile one in, but that isn't a great solution - you have to recompile vim on every computer you use it on. The patch is here: http://www.wana.at/vimshell/ http://www.wana.at/vimshell/
- jcw 17y agoVim-shell isn't bad, but the version on the site is outdated. You have to scour their mailing list to find a working link to a patch that works with vim 7.2.
- dakrone 17y agoI tried Conque and didn't care for it, refreshing was slow and I favored the detached approach. 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.
- graywh 17y ago:h shell-window
- adi92 17y agoTiling a vim-dow beside a REPL-window in a GUI works for me