VIM: how to put the result of a colon command into a variable?

In a VIM script, I want to check if VIM was started with command line arguments or wthout. For this I want to check the result: the args command that prints the arguments. But how do you put the result: args inside an if () variable or a variable. After wll doesn't work:

let s:MyArgs = execute( "args" )

      

+2


source to share


1 answer


You need to play with :redir

. I have encapsulated this operation into a function there .



BTW, argc () should also answer your initial needs in a simpler way. (: h argc ())

+5


source







All Articles