obsidian-latex-suite
obsidian-latex-suite copied to clipboard
[FR] Check regex after the cursor
Please add an option to check string after the cursor with a regex before applying the snippet, and optionally modify it
Ex: { trigger:"{", replacement:"{$0}$1" , after:"[^a-zA-Z]", options:"Am"}
would not open a bracket if directly before a word, and {trigger: "lr\\[", after:"(\\])", replacement: "\\left[ $0 \\right[[a0]] $1", options: "rmC"},
will get rid of the annoying automatic second bracket.
You can add the "w" word boundary option to the snippet so brackets are not opened directly before a word.
Could you clarify what you expect the behaviour of the
{trigger: "lr\\[", after:"(\\])", replacement: "\\left[ $0 \\right[[a0]] $1", options: "rmC"},
snippet to be?
It would expand lr[ text only if the closing bracket is present after cursor. Closing bracket is also captured by the group and substituted into [[a0]] like with groups captured before cursor.