0

This is a part in my .vimrc that is used to change appearance of tabs to (arrow right) and spaces to · (dot).

set list
set listchars=
  \tab:→\ ,
  \space:·,
  \nbsp:·,
  \extends:›,
  \precedes:‹

But if I comment out the first line, it stops working:

set list
set listchars=
  " \tab:→\ ,
  \space:·,
  \nbsp:·,
  \extends:›,
  \precedes:‹

Is it possible to fix it? That is, to make each line can be commented out.

1 Answer 1

3

The line continuation comment syntax in vim script is "\ , documented at :help line-continuation-comment:

set list
set listchars=
  "\ \tab:→\ ,
  \space:·,
  \nbsp:·,
  \extends:›,
  \precedes:‹

The "\ is parsed as one token of three characters. For example, "\tab does not begin a line continuation comment.

1
  • 1
    OPs case highlights another quirk of continuation lines: adding a regular comment (") anywhere results in all following continuation lines becoming part of the comment. This can actually be useful. For example, when using the Decho debugging plugin. The plugin has commands that automatically comment out it's debug/print statements. But it won't comment out any additional continuation lines added by the user. Thanks to the aforementioned behavior, though, things work fine (though it looks "wrong").
    – B Layer
    Aug 29, 2021 at 23:33

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.