I use the yasnippet bundle and it works like charm.
When I want to include placeholders in a PROPERTIES section of an org-document it is not working.
Here's the snipper:
#type: snippet
# --
:PROPERTIES:
${1: :var: name="$2"}
${3: :var: url="$4"}
:END:
$0
What this does is to define 2 optional variables, "name" and "url".
When calling (yas-tryout-snippet)
on the snippet above, the cursor is not positioned correctly.
Here where it should jump:
Press tab 1st: Make whole line ${1: :var: name="$2"}
because it can be optional
Press tab 2nd: Make only "$2" in the line ${1: :var: name="$2"}
.
Press tab 3rd: Make whole line ${3: :var: url="$4"}
because it can be optional
... and so on
Here's what it actually does:
Press tab 1st: Make whole line ${1: :var: name="$2"}
because it can be optional
Press tab 2nd: Make whole line ${3: :var: url="$4"}
The problem seem to be produced by the :var:
Keyword.
It stops yasnippet from jumping to the $2
. If I change it to only var:
or :var
it will work. But then it won't be able to include these properties into a src code block and work with it.
It will also work if I remove the quotes from the placeholder. So this will work, but as before, then I cannot eval the url var in code blocks
${3: :var: url=$4}
I also tried excaping things with no luck:
${3: :var: url=\"$4\"}
or
${3: :var: url='$4'}
or
${3: \:var\: url="$4"}
Any ideas on how to write this snippet or what I'm doing wrong.