reddit / emacs

Dynamic snippets that you expand after writing all information?

CeamoreCash · 2022-09-09 17:03
The snippets for yas-snippet require you to expand the snippet then fill in the blanks. I want write snippets where I write all the information first then expand the snippet. For example, I am using [emmet-mode](https://github.com/smihica/emmet-mode#html-abbreviations) in emacs which allows you to write snippets for the web then expand them after writing. I'm wondering if there is a way to write custom snippets like this. https://i.redd.it/e7or1qtu5vm91.gif
AndreaSomePostfix · 2022-09-09 23:16
I am also interested by that feature. I think I asked something like that for company-mode + yasnippet, but I understood it wasn't simple to implement. But if emmet already does it, maybe there is a way to make that generic? Although I am pretty sure to have seen somebody use yasnippet like that in one of the past emacs conf, but I cannot remember where.
hkjels · 2022-09-10 13:59
You could extend/customize emmet. https://docs.emmet.io/customization/ I haven’t looked into your specific use case, but Skeleton also support arbitrary lisp, maybe worth looking into
akirakom · 2022-09-10 15:43
Tempo supports multiple placeholders and is more powerful than skeleton. For emmet-like expansion, you could write your own function. It is similar to completion.