The eval -- "%%EXPANSION{%arg{1}}"
trick is awesome — with %file
, %sh{}
, %opt{}
. The only problem is that the content inside %EXPANSION{}
must balance braces (and in correct order too).
For %file
, I would recommend eval -- reg dquote "%%file<%arg{1}>"
— and then the filename needs to balance angular brackets instead. Those are unlikely to appear in filenames.
I’m doing this in k9s0ke-shlib
/ Kakoune commands (k9s0ke-file2reg
, k9s0ke-file2opt
, def-sh-with-prelude-cmd
).