1

I would like to create a yasnippet snippet as follow: pressing weather I would like that would be inserted the following text current weather = with the cursor after the = (this can be done with current weather = $1). I would so like that a context menu with some suggestion will appear, like sunny, rainy, and so on.

How can I do this? Have I got to use in some ways autocomplete or company? Thank you.

1 Answer 1

2

One way to do this is with yas-choose-value:

# -*- mode: snippet -*- # key: weather # -- current weather = ${1:$$(yas-choose-value '("sunny" "rainy"))} 

Please read through the writing snippets section of the documentation because it answers many of your recently asked questions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.