Skip to content

Adding support for regex as keys when expanding snippets #988

@Zetagon

Description

@Zetagon

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 and yas-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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions