Can a snippet dynamically remove parts of itself?
This is primarily for my puppet snippets. There currently is a snippet like this:
snippet user "user resource type" b
group { "${1:username}":
ensure => ${2:present},
uid => ${3:uid},
gid => ${4:gid},
comment => '${5:gecos}',
home => '${6:homedirect
managehome => false,
require => Group["
endsnippet
So the problem I'd like to solve is: how can I eliminate fields from this resource that I don't want to specify. I could Ctrl-J past them and then delete them afterward, but it'd be nice to eliminate a line (like the "comment =>" one, for instance), if I Ctrl-J through it without entering any data.
That way, I can make my puppet snippets contain all the keys without needing to do a lot of post editing.
"group<
group { "user":
ensure => present,
uid => 123,
gid => 123,
home => '/home/user',
managehome => false,
require => Group["user"],
Is this possible?
BTW, thanks for a fantastic plugin. I'll have some improved puppet snippets to contribute soon.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- UltiSnips Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Nate Jones for more information if necessary.