jaredly / treed

Powerful Tree Editor
http://jaredly.github.io/treed/
1.71k stars 193 forks source link

LISP editor #30

Open wpcarro opened 5 years ago

wpcarro commented 5 years ago

Cannot believe I just discovered this. I've been planning to make a generic editor for trees for a little over a year. Plus the vim bindings really seals the deal for me. Thanks for publishing this!

I've wanted to write something like this to edit LISPs. Obviously it could be extended to handle other ASTs, but I felt the barrier to entry with a LISP would be lower.

Structured editors like paredit have a nice vocabulary for editing trees that I think treed could use as a reference for actions it might want to support -- if it doesn't do so already.

One example of this might be "splicing" - e.g. (1 (2 3 4)) => (1 2 3 4) if the (2 3 4) embedded list was spliced. I think this would be the same as multi-selecting all 2 3 4 children and pressing Shift+tab to dedent them, so perhaps it's not worth supporting. The small difference is that it can be invoked when either the 2, 3, or 4 node is focused.

I'd be interested to see if there are other verbs that treed could support. I'll take a look when I write a small LISP editor demo.

wpcarro commented 5 years ago

Just remembered: other verbs like "slurping" and "barfing" would be great additions too!

This is a nice paredit reference for those less familiar with these ideas.