Using an argument of a function in normal mode in Vim?
I have a Vimscript function defined like this:
function Cs(a, b)
normal a:a|"cylr a:b|x"cP
endfunction
However, the intended action (do some crazy 开发者_开发百科stuff with the arguments a and b in normal mode) doesn't work, instead it takes the first "a" as "append" and writes the rest of the line to the file.
How can I use arguments on a "normal" statement in Vimscript? I found no way to do this.
You need to build up a string with the parameters in and execute it with the :exec
statement.
e.g. something like this:
function Cs(a, b)
exec "normal " a ":" a "|\"cylr " a ":" b "|x\"cP"
endfunction
精彩评论