Clojure

Editors

Clojure is an interactive language and you will only get the best Clojure experience by using an editor that supports code evaluation (via a connected REPL) and structural editing (manipulating code forms as if they are data, not text). Fortunately, there are many excellent Clojure editors that provide these features and many other programmer conveniences.

Note that many of the editors described below are in active development. Links and resources here might become stale. We welcome questions and issues!

Emacs is one of the oldest editors still in active use. As a platform extensible in its own variant of Lisp, options exist for almost anything you might want to do. As you may expect, great extensibility means configuring this tool to your liking can be a job in itself and for some Emacs is more of a lifestyle than an editor. That said, there are friendly starting points just for Clojure developers and you choose the rate at which you absorb the Emacs ecosystem.

The main Emacs modes to be aware of are:

  • clojure-mode, an Emacs major mode that provides font-lock (syntax highlighting), indentation, navigation and refactoring support for Clojure(Script)

  • CIDER extends Emacs with support for interactive programming in Clojure via cider-mode, an Emacs minor-mode that complements clojure-mode to provide interactive support.

  • inf-clojure - provides basic interaction with a Clojure subprocess (REPL), based on ideas from the popular inferior-lisp package

Some places to start:

  • GNU Emacs - download and install - the official GNU Emacs page

  • Practicalli guide to Spacemacs, a community driven Emacs configuration for Clojure - includes clojure-mode and CIDER

  • Prelude - an Emacs configuration for Emacs beginners, not specific to Clojure, but includes Clojure support (clojure-mode, CIDER)

  • Aquamacs - Aquamacs is Emacs designed for the Mac native user in mind and is sufficient for a minimalist Clojure environment when paired with inf-clojure mode

IntelliJ - Clojure with a Java tilt

IntelliJ IDEA is one of the premiere "modern" IDEs with support for a wide variety of languages and tools. IntelliJ made its name as a sophisticated Java editor, leveraging a static analysis platform to provide great explorability and refactoring for large Java codebases. The IntelliJ IDEA Community Edition for JVM development is available as a free download.

Two important plugins are available to enable Clojure development on IntelliJ:

  • Cursive - a full featured Clojure development environment

  • clojure-extras - integrates extras like inline evaluation results and linting via clj-kondo

Cursive is a good fit if you are already familiar with Java or expect to work with mixed Clojure/Java projects.

VS Code - rapidly evolving, beginner friendly

Visual Studio Code is rapidly growing in use for a variety of languages, and Clojure is no exception.

The Calva environment for interactive Clojure development uses a mix of static and dynamic analysis to provide a wide range of language support. Additionally, Calva has made extra efforts to be approachable to beginners with their Getting Started experience, which is a zero-install version that runs in the browser.

Vim - highly efficient text editing

Vim (or vi) is also an editor with a long history, known for its ability to edit text quickly and efficiently. It has become the de-facto replacement for vi, the original Unix visual editor on which it was based.

Its unique, powerful UI is popular enough that most other editors mentioned above include vi-modes that reproduce Vim’s core UI functionality.

Neovim is a fork of Vim. While it maintains a high degree of compatibility, there are some significant differences between the two editors.

Both Vim and Neovim are highly extensible and a vast array of plugins are available for them. Most, but not all, plugins will work with both editors.

The following plugins provide Clojure support for both Vim and Neovim:

The following plugins only provide Clojure support to Neovim:

  • Conjure - focus on interactive development

In addition to the Clojure plugins, it is also worth extending Vim to improve the editing of s-expressions. The plugins below can be used with both Vim and Neovim:

There are also numerous plugins that provide color-matching of parentheses.

Others

Other environments exist but are less active and/or less used. See the Tools page for other ideas.

Original author: Alex Miller