Formatting

Here’s how to maintain your code neat and tidy.

Reformatting code

Cursive will try to maintain the formatting of your code while you’re editing, but in case you want to reformat some or all of it, you can use Ctrl Alt L (Cmd Alt L on Mac) to do so. You can even reformat the whole project or selected directories by using this command in the project window.

Indent line

If you’ve configured Emacs Tab as recommended in our Getting Started page, you can re-indent the current line at any time by pressing tab. Otherwise you can invoke the Auto-Indent Lines action with Ctrl Alt I (Cmd Alt I on Mac).

Code style settings

You’ll find the Code Style settings for Clojure code at Settings→Editor→Code Style→Clojure – there you can modify some general settings. However to adjust the indentation settings for a particular macro, you’ll need to do the following. Find an instance of the macro in your code, and position the cursor over the macro symbol. You’ll get an intention lightbulb which will allow you to modify the indentation using Alt Enter.

Coming Soon: A much better way to do this.