Skip to content

Define custom placeholder/snippet variable for regex triggers? #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
9iovaferra opened this issue May 15, 2025 · 2 comments
Open

Define custom placeholder/snippet variable for regex triggers? #1573

9iovaferra opened this issue May 15, 2025 · 2 comments

Comments

@9iovaferra
Copy link

Hello,
In Obsidian I have installed the LaTeX Suite plugin which lets you define snippets for math blocks in markdown files. With this plugin you also have the ability to define snippet variables, for example:

"${GREEK}": "alpha|beta|gamma|delta ... "

which you can use inside triggers, such as:

"snippets": "[{trigger: '([^\\\\])(${GREEK})', replacement: '[[0]]\\[[1]]', options: 'rmA', description: 'Add backslash before Greek letters'}]"

This is really useful when you have a long list of optional patterns in a regex, instead of typing (alpha|beta|gamma|delta ... ) in the snippet's trigger, ESPECIALLY if you want to use this pattern in multiple snippets.

I've read the documentation and googled it but couldn't find a way to replicate this in UltiSnips. Did I miss something? If not, I guess this could be a feature request.

@SirVer
Copy link
Owner

SirVer commented May 17, 2025 via email

@9iovaferra
Copy link
Author

Amazing, loving UltiSnips by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants