I want to have a gray eol character set by
set list listchars=tab:>>,trail:$
where there are no spaces next to the character ":"
I get no eol character for the above code if I use no spaces next to ":".
I get a green trailing character if I use one space at
- - tab:[space]>> --
although I have not set it up explicitly
such that
alt text http://dl.getdropbox.com/u/175564/trailingCharacter.png (old code in terminal)
How can you make the eol character gray in Vim, and to make it work again?
There are two highlighting groups: SpecialKey and NonText. The trailing characters you mention belong to the NonText one.
Try something like this (y/pasted):
set list
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
hi NonText ctermfg=7 guifg=gray
Does that work for you, or did I understand the question wrong (quite possible).
The trail
, tab
and nbsp
listchars use the SpecialKey
highlight group, so you can use this:
highlight SpecialKey ctermfg=8
to make the $
symbol grey. If you have 256 colors enabled, you can use a different shade of grey, like 243, etc.
If you want the eol to be gray, specify the eol suboption of listchars
instead of trail :
set list listchars=tab:>>,eol:$
trail shows the unnecessary whitespace characters at the end of the lines, not the end of lines themselves.
If you want to set the color of eol , you have to set the highlighting of the NonText
group:
highlight NonText ctermfg=8 guifg=gray
If you specify both ctermfg
and guifg
, the highlighting will work both in the GUI and in a terminal.
I have to point out though some shortcomings:
NonText
. So if you set gray eols, you will be gray tildes. ctermfg=8
makes red and not gray text.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.