0

How can I use a snipmate variable in an expression?

snippet foo
    ${1:4} + 2 = `$1+2`

With the default value of 4 the above snippet produces:

4 + 2 = 2

Thanks.

tbrandon
  • 1
  • 1

1 Answers1

0

At least in the original snipMate plugin, expressions are evaluated first, then tab stops. This allows you to define things like ${1:`v:version`}, but it makes your use case impossible to achieve.

Have a look at UltiSnips; it is modern and powerful, and might allow this. There are more alternatives, see this list on the Vim Tips Wiki.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324