几行指令


9

有没有一种方法可以将单行指令分成几行?

例如,我想转型

setlocal variable_name = condition1 ? "1" : condition2 ? "0" : condition3 ? "a long string" : "another long string" 

进入

setlocal variable_name = condition1 ? "1" : 
                         condition2 ? "0" : 
                         condition3 ? "a long string" : 
                                      "another long string" 

但是当我像上面那样尝试时,会引发“无效参数”错误。

Answers:


10

要在vimscript中包含多行,您需要在下一行之前添加 \

setlocal variable_name = condition1 ? "1" : 
                       \ condition2 ? "0" : 
                       \ condition3 ? "a long string" : 
                       \              "another long string" 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.