New user cannot get beginning-of-line snippets to work with overwrite

Asked by Tim

I want to have different snippets triggered depending on whether or not I'm at the beginning of a line. My snippets file is as follows.

snippet testsnippet "standard version of testsnippet"
expansion of the standard version of testsnippet
endsnippet

snippet testsnippet "beginning-of-line version of testsnippet" !b
expansion of beginning-of-line version of testsnippet
endsnippet

When I try to expand testsnippet at a point that is not the beginning of a line, then UltiSnips automatically uses the standard version, as expected. However, when I try to expand testsnippet at the beginning of a line, then Ultisnips prompts me to choose between the standard version and the beginning-of-line version. I was under the impression that the "!" option would make it so that I wouldn't have to choose between the two snippets when I trigger the snippet at the beginning of a line. I only started playing around with UltiSnips today, so I'm probably doing something very silly. Any help is greatly appreciated.

Question information

Language:
English Edit question
Status:
Answered
For:
UltiSnips Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
SirVer (sirver) said :
#1

The ! option has long, long been deprecated and removed. The new way of doing this is with the priority keyword. The project now also lives on GitHub:

https://github.com/sirver/ultisnips

Give the snippet that you want to expand in the middle of the line a lower priority than the one with the "b" option and you should be fine.

Can you help with this problem?

Provide an answer of your own, or ask Tim for more information if necessary.

To post a message you must log in.