Open Zetagon opened 5 years ago
I'm not working on this anymore, and don't intend to in the future. If anybody wants to work on it, feel free to do so.
I needed this for react to simulate the way they do it in vscode with emmet. I ended up doing this:
# -*- mode: snippet -*-
# name: class name expansion
# key: .
# --
<div className="$1">$0</div>
Ideally I would like to do this as the key .someName
and automatically expand to this:
<div className="someName">cursor-here</div>
I know this is how it works in ultisnips, given the power of elisp and yasnippet IDKY this is not a thing.
I read https://castel.dev/post/lecture-notes-1/ and wanted to replicate at least the simpler parts of the fraction snippet. Is it possible to easily write such snippets in yasnippet where the key is a regex?
In case it is not currently possible I have hacked together some elisp code using the interface provided that can do this but it is not very integrated into yasnippet. I have basically made a new keybinding that checks if a regex has matched. If it matched a corresponding snippet is expanded using
yas-lookup-snippet
andyas-expand-snippet
. The configuration still happens in elisp code and not in a snippet buffer which is suboptimal.Is anyone else interested in using regex as keys? If so I could with some help integrate this more into yasnippet and merge it.