-
Notifications
You must be signed in to change notification settings - Fork 312
Description
I've been trying to figure out a way to have an optional field. For instance
task ${2:lifetime} ${1:taskname} (
$0
);
endtask : $1
Field 2 is optional, but I do want it to be present in case it's required. When the snippet expands, lifetime is presented and there are spaces around it. If I type in the name, then tab, I'm highlighting lifetime. If I hit C-d it erases lifetime and I can then tab and go to the $0 position, however the location of field 2 has two spaces now.
I've tried: task ${2:lifetime }${1:taskname} ( which works a little better if deleted, however then does require that the user then hit space after they type the lifetime keyword desired.
I fiddled with an ELisp transformation but couldn't quite find anything that would transform only after the whole word was typed in (for example ${2:lifetime $(concat yas-text " ")} operated after every key and was really wrong.
Any ideas on how to accomplish an optional field that will not leave a blank space?