Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vimscript: Can list creation be split over multiple lines?

Tags:

vim

Does Vimscript allow for this notation style when creating a list?

let mylist = [
               "a",
               "b",
               "c"
             ]

Or is it confined to one-liners (let mylist = [ "a", "b", "c" ])? I'm writing a list that I can easily foresee adding elements to later.

like image 372
ivan Avatar asked Jan 05 '14 17:01

ivan


1 Answers

You can make a statement in vimscript span multiple lines by adding a \ to the start of the next line

let mylist = [
  \"a",
  \"b",
  \"c",
  \]

This is covered in :help line-continuation (doc)

like image 169
JaredPar Avatar answered Oct 23 '22 06:10

JaredPar