Fork me on GitHub
#vim
<
2020-02-07
>
futuro16:02:47

Does anyone know of a way to align clojure map k/v pairs? I’ve used Tabularize for aligning other types of files, but I was hoping for something like clojure-align in emacs’ clojure-mode

dominicm17:02:14

I don't think there's anything quite so semantically aware

futuro17:02:50

Thank you, regardless :)

dave17:02:31

i just had a shower thought that https://github.com/borkdude/edamame could potentially be used to find the last column of every key in the map, determine what column every value should start on, and adjust the values accordingly

dave17:02:21

i guess you would also need to figure out what selection of text to send through edamame, or otherwise maybe parse the entire file and then somehow find where your cursor is in the output

dominicm17:02:37

Cljfmt has a pr to do this

dominicm17:02:49

Then gw will work

dave17:02:36

ah yes, that's right. i remember seeing that now

dave17:02:47

it's funny how a feature that feels so simple on the surface is actually so complex underneath 🙂

defndaines18:02:58

I’ve always used gq, but:

gw{motion}              Format the lines that {motion} moves over.  Similar to
                        gq but puts the cursor back at the same position in
                        the text.  However, 'formatprg' and 'formatexpr' are
                        not used.

borkdude21:02:25

thanks!

🙂 8
dominicm22:02:02

I think I meant gq anyway :)

dominicm22:02:23

gw is great for comments, as those don't seem to do so well with gq