[英]Unable to make gray eol character by .vimrc
I want to have a gray eol character set by 我希望有一个灰色的eol字符集
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 ":". 如果我在“:”旁边没有空格,我的上述代码没有eol字符 。
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) alt text http://dl.getdropbox.com/u/175564/trailingCharacter.png (终端中的旧代码)
How can you make the eol character gray in Vim, and to make it work again? 如何让Vim中的eol角色变灰,并使其再次起作用?
There are two highlighting groups: SpecialKey and NonText. 有两个突出显示组:SpecialKey和NonText。 The trailing characters you mention belong to the NonText one. 您提到的尾随字符属于NonText字符。
Try something like this (y/pasted): 尝试这样的事情(y /粘贴):
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: 该trail
, tab
和nbsp
listchars使用SpecialKey
高亮组,所以你可以使用这个:
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. 如果启用了256种颜色,则可以使用不同的灰色阴影,如243等。
If you want the eol to be gray, specify the eol suboption of listchars
instead of trail : 如果您希望eol为灰色,请指定listchars
的eol子选项而不是trail :
set list listchars=tab:>>,eol:$
trail shows the unnecessary whitespace characters at the end of the lines, not the end of lines themselves. trail在行的末尾显示不必要的空格字符,而不是行本身的末尾。
If you want to set the color of eol , you have to set the highlighting of the NonText
group: 如果要设置eol的颜色,则必须设置NonText
组的突出显示:
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. 如果同时指定ctermfg
和guifg
,则突出显示将在GUI和终端中都有效。
I have to point out though some shortcomings: 我必须指出一些缺点:
NonText
. 他们的重点都是由NonText
的突出显示NonText
。 So if you set gray eols, you will be gray tildes. 因此,如果你设置灰色eols,你将是灰色的波浪。 ctermfg=8
makes red and not gray text. 在我的终端上, ctermfg=8
会生成红色而不是灰色文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.