Formatting code

Consistent formatting really aids the readability of a code base.

Spacemacs Clojure layer will format the code as you type. When pressing RET the cursor correctly indents. TAB key will also left align the current line of code.

Discussion on formatting


cljfmt is a tool for formatting Clojure code idiomatically.

The following piece of code is hard to read as it is not cleanly formatted

( let [x 3
    y 4]
  (+ (* x x
  )(* y y)

Using cljfmt will convert this into nicely formatted Clojure code

(let [x 3
      y 4]
  (+ (* x x) (* y y)))


It is not the goal of cljfmt to provide a canonical format.

results matching ""

    No results matching ""