Chuck
Chuck

Reputation: 4892

Prevent Duplicate UltiSnips Matching

I have two UltiSnips triggers defined that are matching in one particular way that I want to prevent. The first trigger is defined as this:

snippet "exa(ct)?" "Exact" r

The second like this:

snippet "getct|ct" "Get( CurrentTime )" rw

Typing exact<tab> gives me UltiSnips' choice message to select one of the above. Shouldn't the w option at the end of the second snippet prevent it from firing unless it's surrounded by non-word characters?

Upvotes: 3

Views: 251

Answers (1)

Chuck
Chuck

Reputation: 4892

The solution was to use \b at the beginning of the regular expressions and forego the w option, as r always overrides the other options.

snippet "\bexa(ct)?" "Exact" r
...
snippet "\bgetct|ct" "Get( CurrentTime )" r

Upvotes: 3

Related Questions