In Vim can you stop the color change of white space characters with 'set cursorline' on?

五迷三道 提交于 2019-12-02 23:09:55

You can use :match to highlight the tabs.

:match NonText '^\s\+'

That seems to override the cursor line. It would be better of course to use matchadd() but it seems to be overriden by the cursor line. There might be a way to make it work

Following lines in .vimrc fixed the problem for me.

au VimEnter * call matchadd('SpecialKey', '^\s\+', -1)
au VimEnter * call matchadd('SpecialKey', '\s\+$', -1)

It overrides other styles application for tabs and trailing spaces inside a cursor line.

Yes you can. From :help listchars (at the end):

The "NonText" highlighting will be used for "eol", "extends" and "precedes". "SpecialKey" for "nbsp", "tab" and "trail".

With this knowledge you can modify your color scheme accordingly or add a call to highlight in your vimrc.

I believe you have 'cursorline' set. The CursorLine highlight group defines the highlights for the same. Either you set nocursorline, (which can speed line movements) or change the CursorLine highlight groups fg colors.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!