I want to be able to use some normal commands I tend to use in the day to day as an input for another function, for example 4X
, I would like 4X
to be expanded to XXXX
and then use it in a function as :substitude(s, 'here', <expand result of 4X>, 'g')
It's there an easy way to set this up?
:substitute
, and it has an eponymous functionsubstitute()
; the command can be run with a colon, but does not use left/right parens like a function—it uses a delimiter character to separate pattern/replacement/flags. The function uses parens, and must be:call
ed or appear in an expression position (like after:echo
or on the right-hand side of a:let
).