This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.
The Atom documentation is excellent. It's highly worth reading the flight manual.
These are the ones I install related to Clojure development.
- proto-repl - Clojure REPL, autocompletion, etc.
- proto-repl-charts - Graphs and Charts
- ink - Proto REPL dependency used for inline display and the REPL output.
- tool-bar - Proto REPL uses this to display a tool bar with options.
- Parinfer - Handles parentheses and general Lisp editing.
- lisp-paredit - Used only for proper indentation on newline and indenting blocks of code. (Hopefully Parinfer will handle all of these in the future)
- highlight-selected - highlights selected keywords throughout an editor.
- set-syntax - Easily change syntax with the command palette.
This is the built in package that comes with Atom for the Clojure Grammar. I find the default settings bad for the way that I work. I recommend changing them to the following.
- Auto Indent: unchecked
- Auto Indent On Paste: unchecked
- Non Word Characters: ()"':,;~@#$%^&{}[]`
- Scroll Past End: checked
- Tab Length: 1
Everything else is left at the default.
Enabled Checkboxes: auto pretty print, auto scroll, display executed code, enable completions, prefer lein, all the refresh check boxes, show inline results, use clojure syntax.
- Enabled: checked
- Strict: unchecked
- Indentation Forms:
try, catch, finally, let, are, /^def.*/, fn, cond, if, if-let, for, /when.*/, testing, doseq, dotimes, loop, ns
- Keybindings Enable: unchecked
These are main Atom Settings related to Clojure that are different than the default.
- Auto Indent On Paste: unchecked
- Scroll Past End: checked
- Due to this autocomplete issue there is a lot of flashing from the autocomplete window that pops up. Scrolling down farther usually resolves the issue.
Atom has a place for custom styles. Place the following in your styles.less. This disables unbalanced lisp-paredit parentheses indicators in the REPL.
.proto-repl-repl::shadow .lisp-syntax-error .region {
background-color: rgba(0, 0, 0, 0) !important;
}
The files included in this gist init.coffee and keymap.cson contain additional settings for Atom. You can paste their contents in the files after opening them in Atom.