Open hoclun-rigsep opened 2 years ago
I would be happy to support lisp-like filetypes, but I don't have practical experience with them, so I don't know what kinds of splits and joins would make sense, what settings to provide, etc. If you use a lisp yourself, do you have any specific transformations you do often that the plugin could support? Maybe a few before/after examples of code snippets?
Absolutely. My only experience is as a novice Clojure/ClojureScript
user. Source consists of "forms" which are delimited by ()
[]
and
{}
. Even a function call is just a (fn arg1 arg2)
which means the
syntax is extremely general.
Simple examples, this calls the function +
:
(+ 2 3 4 5)
(+
2
3
4
5)
guns/vim-sexp
provides indentation.
From my project, this is properly indented and the brackets appear where they should:
(dispatch [::events/insert-staff-entry
day-ord
shift
unit
@why
@who])
Would be nice to go to this, and back:
(dispatch [::events/insert-staff-entry day-ord shift unit @why @who])
If you need more discussion/research, I will help.
I've added some basic support to the main branch -- could you pull and try it out? If it works well for some of your real code, I'll write up some documentation, and if there's edge cases I haven't considered, I'll see what I can do to work them out.
Thanks, very cool. I'll play with it at work next week and collect my experience.
Still working on my report, thanks again
Want to thank you for this, I had to move away from using Clojure at work for a while but I still intend to report back here.
This is already useful as is—thank you.
Here's an issue:
(map (fn [[d s u i]] ^{:key i}
[:tr
[:td
[row d s u i]
"DOG"]])
staff-keys)
If I position the cursor on :td
(the form here is a "vector', vector literals [look like this]
) and press gJ
here is what I would expect: the :td
form on one line, trailing delimiters from enclosing forms also on that line.
(map (fn [[d s u i]] ^{:key i}
[:tr
[:td [row d s u i] "DOG"]])
staff-keys)
What I get is:
(map (fn [[d s u i]] ^{:key i}
[:tr
[:td [row d s u i] "DOG"]]) staff-keys)
It's funny, I was just fixing a very similar bug for a separate problem 😅. So at least I know what the issue is -- it should be fixed now.
It does look fixed. I'll let you know what else I come across this week as I'm back at my Clojure/Script projects.
Any plans for supporting Clojure and/or lisps generally?