New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand output of interpolation #1488
Comments
hektor
changed the title
Expand output of interpolation (e.g. for generating choice syntax)
Expand output of interpolation
Sep 22, 2022
This can be done through the expansion of an anonymous snippet: global !p
def font_names_choicer(snip, filename):
file = open(filename, "r")
font_names = file.readlines()
snip.expand_anon('${1|' + ','.join(font_names) + '|}')
endglobal
post_jump "font_names_choicer(snip, '/tmp/fontnames.txt')"
snippet fontnames_snippet "Snippet for fontnames"
endsnippet In the above, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to create a snippet to make a choice from a list of options. As UltiSnips supports
choices via the
${1|<choice-1>,...,<choice-n>|}
syntax I was wondering if there is any way to use shell code interpolation to generate the choice syntax.When I use the following snippet
UltiSnips expands to the following:
where I would actually like to expand this again to get the desired menu of choices.
Is there a way to achieve this with UltiSnips?
The text was updated successfully, but these errors were encountered: