Skip to content

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

@9iovaferra

Description

@9iovaferra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions