I would like to write snippets that can be expanded after typing only a part of the trigger word. For example, i, im, imp, impo, impor should all expand to import when followed by the trigger key, e.g. Tab. This is helpful because one may think of a snippet after having already typed a couple of characters of a code construct. At the moment, this is possible through somewhat complicated regexes, making it hard to define such snippets. Is this supported in an easier way? If not, would it make sense to add a snippet option for this?
The text was updated successfully, but these errors were encountered:
danijar
changed the title
How to insert snippets by only typing partial prefix of the trigger word?
Typing only partial prefix of the trigger word?
Apr 13, 2020
Nevermind, I found #268. You're mentioning completers that are better suited for this use case. Which ones were you thinking of? By the way, I think it would be perfectly fine if this didn't work for regex triggers if it were added as a feature.
As you noted, the regex for this would be rough: i(?:m(?:p(?:o(?:r(?:t?)?)?))?)? Personally I would also love the feature that you're proposing and that was proposed in #268.
One popular completer is deoplete, and many people swear by it.
Thanks for sharing the regex. If this worked it should be really easy to add this feature as a snippet option to UltiSnips.
I'm using droplete but so far it seems to fill quite a different use case than triggering snippets that may include anchors for the cursor to jump to etc.
SirVer
changed the title
Typing only partial prefix of the trigger word?
Expand snippets if only partial prefix of the trigger word is typed
Feb 15, 2021
I would like to write snippets that can be expanded after typing only a part of the trigger word. For example,
i,im,imp,impo,imporshould all expand toimportwhen followed by the trigger key, e.g. Tab. This is helpful because one may think of a snippet after having already typed a couple of characters of a code construct. At the moment, this is possible through somewhat complicated regexes, making it hard to define such snippets. Is this supported in an easier way? If not, would it make sense to add a snippet option for this?The text was updated successfully, but these errors were encountered: