Here’s the sitch:
You want to learn Clojure. You don’t know which editor to use. You do research and it looks like everybody is saying emacs is required to edit Clojure. You’re wondering what your options are and if you’ll be missing out if you’re not on emacs.
The problem with the many Clojure resources out in the wild is that they’re outdated. They suggest that Emacs is the only way to go when editing Clojure, which leads to you being frustrated as a non-Emacs user. Don’t worry though, it’s 2017 and we have much more than just Emacs to write Clojure in.
Most importantly, you shouldn’t feel that you’re forced to switch to a different editor just because you’re learning a different language.
Let’s go over the most popular editors and IDEs people are using to edit Clojure with.
Light Table is an IDE developed in Clojurescript. It’s relatively simple to learn, free to use, is open source, and is great for complete beginners.
Light Table also has many plugins that you can install to customize your editing experience.
I’d recommend Light Table to you if you were new to programming and Clojure.
Nightcode is an IDE written in Clojure for Clojure. It supports both the boot and leiningen build tools and structural editing.
One of the cool things Nightcode does is that it shows your code evaluated live right next to the source code itself.
There are plenty of keyboard shortcuts too for people that don’t like moving their hands away from their mouse.
I’d recommend Nightcode to you if you were new to programming and Clojure.
Atom and ProtoREPL
ProtoREPL integrates a REPL with Atom like other editors.
On top of being able to do the basics like run your tests and evaluate code, some unique features include:
- Save and View Local Bindings
- Display evaluation results inline
- Create visualizations
- Lookup Clojure documentation
For Sublime Text users, SublimeREPL will be what you’re looking for, although it hasn’t been maintained. If you’re just trying to dip your feet into Clojure without learning another editor, give it a shot. I would, however, recommend that you migrate to using Atom if you’re a Sublime Text user to use ProtoREPL. The overall experience of Atom is similar to that of Sublimes’ with the added benefit of ProtoREPL and a more active plugin ecosystem.
Vim with Fireplace
Vim Fireplace is a Vim plugin that integrates nREPL with Vim. It allows you to do to jump to definitions of functions, evaluate your code while working, and run your tests.
Jeb Beich recently wrote an article on how he develops Clojure with NeoVim. Jeb takes advantage of the RPC API in Neovim to add REPL support.
For an additional resource on setting up Vim for Clojure, see Juxt’s article Clojure and Vim
Emacs with CIDER
If you’re already using Emacs, then you definitely want to stick to using Emacs. Emacs is my editor of choice for Clojure, and with the CIDER plugin you’ll get a great Clojure editing experience.
Some features CIDER gives you over the other editors are:
- Java Object Inspection
- Step Debugging
- Test Running
There’s a few other Emacs packages that may be helpful to you:
If you’re coming from Vim and want to be able to use CIDER, you could give Spacemacs a try. It’s a customized distribution of Emacs designed for evil-mode, which is essentially Vim bindings in Emacs.
IntelliJ and Cursive
The Cursive plugin for IntelliJ is free for people learning Clojure or doing open source work, but can cost money for commercial usage.
Cursive is the best option if you’re already on IntelliJ and want a familiar interface. It supports a lot of the same things CIDER does, including structural editing, tests, and debugging.
Additionally, since this is a paid tool for commercial use, the author is actively developing more features and provides support for the plugin.
Eclipse and CounterClockWise
CounterClockWise is an Eclipse plugin for Clojure development.
Java developers already using Eclipse and want to try Clojure should give this plugin a shot. They’ve added support for Clojure 1.9 in December of 2016 so it’s not by any means a dead plugin.
Stick to what you’re already using if possible.
If you’re a beginner to programming and Clojure I recommend either Nightcode or Light Table. If you’re a beginner looking to do more than just Clojure, look into Atom.
Java developers that are already using IntelliJ or Eclipse will be able to use the appropriate plugins there.
I wouldn’t recommend Emacs or Vim to beginners because there’s a steeper learning curve.
Have I missed anything? Any thoughts or comments? You can leave a comment below or send me an email.