14

Is there a way to split a one-line instruction into several lines?

For example, I'd like to transform

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

into

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

but when I try it like above, it raises "Invalid argument" error.

1 Answer 1

19

To have multiple lines in a vimscript you need to prepend the next lines with \

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.