conditional snippet based on variable

Asked by eddie ash

Hello,
I want to write a snippet that will expand to a 2 different things based on a vim variable

example would be
if g:example_var=1
snippet to expand is
class $1 extends class ovm_test
...
endclass: $1

ifelse g:example_var=2
class $1 extends class uvm_test
...
endclass: $1

Is there a way to do this?

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

You are out of luck, this is not supported (at least not if the snippets are very different and contain different amount of tabstops and so on). There have been a lot of questions about dynamic replacement text that would allow this, but for now it can't be done.

Can you help with this problem?

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

To post a message you must log in.