ultisnips icon indicating copy to clipboard operation
ultisnips copied to clipboard

Expand output of interpolation

Open hektor opened this issue 1 year ago • 1 comments

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

snippet fontnames_snippet "Snippet for fontnames"
${1|`cat /tmp/fontnames.txt | sort | uniq | awk 'NF' | paste -sd ','`|}
endsnippet

UltiSnips expands to the following:

${1|Adobe Courier Bold,...,STIXMathJax_Variants-Regular|}

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?

hektor avatar Sep 22 '22 14:09 hektor