Take the 2-minute tour ×

I noted that when I show up the EOL listchars in a text the linebreaks are losen


 this is my text of this 

becomes after set list ..eol

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

I would like to see the EOL characters without breaking the words at window border. Is that possible?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Unfortunately it sounds like this is a documented limitation of Vim. From the documentation of linebreak (the option which causes per-word line breaks instead of per-character):


Alternate solution: highlight end-of-lines. The simple one-time way would be to just search for them (/$). Beyond that, you can use highlighting:

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

That'll give your EOLs green backgrounds. See :help highlight-args for more on how you can specify the highlight.

Original answer

This is not the OP's actual problem, but could sometimes happen, so I'll leave it here for others to find when they search.

From the help on 'list':

Note that list mode will also affect formatting (set with 'textwidth' or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for changing the way tabs are displayed.

From the help on 'cpoptions':

L    When the 'list' option is set, 'wrapmargin', 'textwidth', 'softtabstop' and Virtual Replace mode (see |gR|) count a as two characters, instead of the normal behavior of a .

'cpoptions' is all about vi-compatibility - are you launching vim as vi? Or are you manually setting any of those flags? Check the output of echo &cpoptions, be sure to launch as vim, and if it's still set (no idea why it would be) you can unset the flag (set cpoptions-=L).

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

share|improve this answer
I use GVIM. I don't have textwidth/wrapmargin active because they do put a EOL character at the end of the line. I tried to unset the flag settings cpoptions-=L but it still change the formatting with set list. –  remio Mar 18 '10 at 16:04
Oh, wow. It looks like 'list' turns off 'linebreak'. That's bizarre. I wonder if maybe it's because internally space becomes a real character (even if you're not showing it) and it can't tell where word breaks are? –  Jefromi Mar 18 '10 at 16:32
thank you :match endofline /$/ is a good solution. The only problem is that the end of line spaces is flickering when I enter text in a document ;) –  remio Mar 18 '10 at 20:25
Flickering, huh? My version of vim (7.2 with patches 1-394, and some extra features...) doesn't do that, though it does lose the highlighting if you type at the end of the line. It comes back with ctrl-L, so clearly it's not supposed to disappear! –  Jefromi Mar 18 '10 at 21:23
@remio: I really don't think there's any better solution, and you said this one's good - you might want to accept the answer so it doesn't continue to show up as unanswered. –  Jefromi Mar 19 '10 at 16:25
show 1 more comment

Your Answer


