Vim: displaying listchars changes the screen wrap

I noticed that when I show EOL lists in the text, line-to-line losen

pe

this is my text of this message 

becomes after the given list .. eol

  this is my text of this mess age(EOL CHAR) 

I would like to see EOL characters without breaking the words on the border of the window. Is it possible?

+6
vim eol line-breaks
source share
1 answer

Unfortunately, this seems to be a documented limitation of Vim. From the linebreak documentation (an option that causes line breaks in a line for each character):

This option is not used when the 'wrap' option is disabled or the list is enabled.

Alternative solution: select the end of the line. A simple one-time way would be to simply look for them (/ $). Alternatively, you can use the backlight:

 :highlight endofline ctermbg=Green :match endofline /$/ 

This will give you green EOL backgrounds. For more information on how you can highlight a selection, see :help highlight-args .

Original answer

This is not the actual OP problem, but it can sometimes happen, so I will leave it here so that others can find when they are searching.

Using 'list' :

Note that list mode also affects formatting (set using "textwidth" or "wrapmargin") when "cpoptions" includes "L". See "Listchars" for changing the way tabs are displayed.

Using 'cpoptions' :

L When the “list” parameter is set, “wrapmargin”, “textwidth”, “softtabstop” and Virtual Replace mode (see | gR |) are counted as two characters instead of the usual behavior of a.

'cpoptions' is all about vi compatibility - do you run vim like vi ? Or do you manually set any of these flags? Check the output of echo &cpoptions , be sure to run it as vim , and if it is still installed (I don’t know why it would be), you can disable the flag ( set cpoptions-=L ).

And of course, make sure the settings for wrap , wrapmargin , linebreak and textwidth are what you want.

+2
source share

All Articles