13

I noted that the 'showbreak' symbol is highlighted with the highlight "NonText" color-element. NonText is also used for the EOL Characters.
I would like to keep the highlight-color for the EOL characters but want to change it for the showbreak symbol is that possible?

Another problem is that my showbreak symbol is not displayed. I would like to use this symbol "↳" and put it in the linenumbers column (using set cpoptions+=n). I can't find out how to display the symbol and how to put a space after the showbreak symbol (between the text and the symbol).

Can anyone help me?

Reman
  • 7,931
  • 11
  • 55
  • 97
  • Same issue here, even though this is an old question. For me, it’s annoying that the `showbreak` isn’t the same colour as the line numbers when using `cpoptions+=n`: http://ell.io/k5A7 – ELLIOTTCABLE Nov 03 '11 at 16:31

2 Answers2

9

I don't think you're going to get highlighting to be different than the EOL character, at least I am not aware of a way to do that.

For the second part I can help with. I was able to get "↳ " to show up in my line number column with the following settings:

let &showbreak = '↳ '
set wrap
set cpo=n

Note that there is a space after the . This lines up nice until you have > 9 lines in the file. If you wanted it to line up with the last character of the number column regardless of the number of lines I'm not sure what you're going to have to do.

Edit: I've recently written a proof-of-concept function for someone on IRC that highlights the first character on a line that has been wrapped with a different highlight group. It hasn't been tested much but it seems to work. Not exactly what you're looking for but maybe it's worth a look.

Randy Morris
  • 39,631
  • 8
  • 69
  • 76
  • thank you Randy. When I insert the first line in the commandline I see this: `set showbreak=?\ ` – Reman Apr 22 '11 at 07:50
  • Can you input other multibyte characters in vim? Does the output of `vim --version` have "+multi_byte"? – Randy Morris Apr 22 '11 at 11:02
  • I have only these features included: +multi_byte_ime/dyn +multi_lang. My encoding is latin1. When I change it to utf-8 I can insert above showbreak symbol, but I can't print out in utf-8. Utf-8 gives a lot of problems in many (european) languages. Do you know if there is another way to add +multi-byte to vim without changing encoding to utf-8? – Reman Apr 22 '11 at 13:37
  • Unfortunately I don't know too much about encodings in vim. I only suggested the `+multi_byte` stuff because of how I had to enter the `↳` character (u21b3). – Randy Morris Apr 22 '11 at 13:42
  • I dont know it either. I've read the helpfiles but still don't know what to do. I suppose there is no solution to my question. – Reman Apr 22 '11 at 14:13
6

:help hl-NonText makes it pretty clear that you cannot have different colors for the 'showbreak' string and other non-text strings, of which eol is a member (see :help 'listchars'):

NonText

'~' and '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line).

If you're willing to accept this limitation (@elliottcable) hi! link NonText LineNr will match the 'showbreak' string to the line number colors.

If you really wanted to get clever, as a compromise you could create a mapping or command to toggle between ':set list' and ':set nolist' that would also adjust the NonText highlight setting simultaneously.

If you use :set relativenumber (added in vim 7.3), :set showbreak=↳\ \ \ will reliably keep your 'showbreak' neatly lined up since the number width will not change as you navigate through the file. (This in addition to the :set cpo+=n and :set wrap @Randy Morris mentioned in his answer.)

You'll definitely need UTF-8 for the character, since it does not appear in other encodings. I'd strongly recommend you carefully document your encoding problems, with details about how to reproduce them along with your OS, its version, and the :version output of vim, and post them as separate questions. UTF-8 should be helping you wrangle multiple languages rather than being an impediment.

Araxia
  • 1,136
  • 11
  • 22
  • (late on a party) I wonder whether it's possible to use unicode characters for the `showbreak` like `\uf443` from nerd fonts. So yep, is it even possible? – ddnomad Mar 25 '17 at 23:57