views:

231

answers:

1

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

p.e.

 this is my text of this 
 message

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?

A: 

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):

This option is not used when the 'wrap' option is off or 'list' is on.

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.

Jefromi
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
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
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
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
@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
sorry, yes I forgot it. It's my first time here. Thank you Jefromi.
remio