I'm using Counterclockwise but unfortunately they haven't implemented this functionality yet. Do you have any ideas how can I format my Clojure code automatically in the "lispy" way?
In the latest version of the Counterclockwise IDE you can simply select all in a file Ctrl+A then press Ctrl+I for "Indent the current line" to properly indent the whole file.
Pressing Tab (regardless of cursor position) will do the same for the line where the cursor resides but it won't work when all lines are selected.
There doesn't seem to be a "finished" Clojure indenter for Eclipse and I don't know enough about Eclipse to write one. But there is pretty-printing capability available in Clojure (contrib) itself:
http://richhickey.github.com/clojure-contrib/pprint-api.html
... so what I would do if I was in your situation and really tired of not being able to indent code is to write a little GUI app (you could do it in Clojure for fun and practice) that allows you to cut&paste your code into a TextArea, reformats it on demand and stuffs the formatted code back into the clipboard for you. A clunky solution but one that's fairly easy to implement.
Counter Clockwise version 0.20.0 (October 2013) added a "reindent selection" capability. I know that's not all you wanted, but it's a start.
© 2022 - 2024 — McMap. All rights reserved.
pprint
] (richhickey.github.com/clojure/doc/clojure/pprint/…) in the REPL, then paste your whole buffer in as the argument. :) – Excursionist