I would like to save nicely formatted Clojure code. Eclipse can format code every time a file is saved. It would be nice to have the same in Light Table. Manually, I can do it by selecting all (ctrl+a), then running (ctrl+space) Editor: Smart indent line(s)
. Is there a way to do it automatically every time a file is saved?
You can override key bindings for save in Settings: User keymap
like:
{:+ {:editor {"ctrl-s" [:editor.select-all
:smart-indent-selection
:editor.selection.clear
:save]}}}
But you will lost cursor position (it will jump to the end of file). This can be handled with Marks
plugin. Install the plugin and add command :lt.plugins.marks/jump-to-large-move-mark
onto last position of commands vector.
new Keymap-Style in actual Lighttable (0.7.2)
Press (ctrl+space) -> enter "keymap" and select "User keymap"
[:editor "ctrl-s" :editor.select-all :smart-indent-selection :editor.selection.clear :save]
or with marks plugin
[:editor "ctrl-s" :editor.select-all :smart-indent-selection
:editor.selection.clear :save :lt.plugins.marks/jump-to-large-move-mark]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With