8

sometimes I need to use a variable multiple times in a snippet. For instance, when I need to set a key-value list:

${1}_key: ${1}_value

I hope the cursor can stop at the first ${1} when I trigger snipmate in this case. When I input something like foo at the first ${1}, it can become

foo_key: foo_value

Thus, I need to input foo only once. How can I achieve this?

1 Answer 1

13

It's easy:

${1:}_key: $1_value
Sign up to request clarification or add additional context in comments.

2 Comments

Why is the colon required at ${1:}?
Frankly, I don't know. (Maybe I knew it before, but I can't remember it now) But I want to say Hi to you. I saw your ID before. Thanks for letting the world know the shitty things happening in China :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.