espanso: Something that some might find interesting to try and make an alternative to kakoune-snippets.
Interesting thing, though, it’s not a replacement for real snippets, more like abbreviations really. Also, I believe you can do this with just Kakoune, by using this trick Mapping sequence of keys in insert mode
I was about to say I could see how it’s not like snippets because it doesn’t let you pass arguments, but I just found this. I guess it’s not like snippets in that your expansions aren’t mode/filetype specifc. You can have application specific expansions apparently. So you can possibly have only Kakoune specific expansions.
I guess it’s better to just call them “expansions” than comparing them to snippets or abbreviations.
Pretty cool actually. I’ll have to look into it more some time.
the key difference is that snippets allow expansion of complex interactive templates, in which you can edit multiple parts either simultaneously or one by one, depending on template structure after expansion with a set of special behaviors, such as jumping and mirroring. As far as I can see, this project supports expansion of a trigger into non-interactive result, that is defined by a command in configuration file. Check what yasnippet or UltiSnips provide, and you’ll see the difference
Ah! That’s what I was missing about Yasnippet in Emacs and snippets in general. I absolutely did not read that with $1
, $2
, etc you can press TAB
to go to next one of those, and $0
is the final place for the cursor.
I see now how espanso isn’t like snippets. Still cool though.
Actually, if you didn’t have to take into account indentation you could possibly implement that in a similar fashion, by maintaining state… because in most applications leftarrow is going one character backwards.
I mean, you won’t have fashionable things like expanding an snippet and having something selected because selecting text is different in most applications, but you can have your cursor be put in place and then moved to the next placeholder.
Funny enough, when I’ve implemented basic snippet manager for vim, I had a lot of troubles because of how moving works. It’s inconcise, enven when you’re using left or right I don’t even try to imagine how I would port this to any other editor
I’ve now realized that I’m arguing about the snippets too much here. Like really too much. By here I mean this whole community site