开发者

How do I change the character Vim uses to number blank lines in a buffer?

Currently, when my window is开发者_如何学JAVA bigger than the buffer being displayed, blank lines beyond the end of file are shown with the ~ characters in the line number column. I would prefer for the line number column for those lines to be blank. Is it possible to make it so?


As of Vim 8.0, the color of the filler line character (~) can be changed indepedently by configuring the EndOfBuffer highlight group:

highlight EndOfBuffer ctermfg=bg guifg=bg


Unfortunately, it is not possible to change the tilde character that Vim uses to show the lines beyond the end of a file (without modifying the source code).

A viable workaround is to hide those tildes by configuring the NonText highlight group, which is used for displaying them, so that its foreground color is the same as the background one:

:highlight NonText ctermfg=bg guifg=bg

However, this approach is not a complete solution, because this highlighting group is also used for rendering the list characters (see :help 'list' and :help 'listchars'), making it impossible to specify highlighting just for the beyond-last-line markings.

Starting with version 8 (see :helpg Patch 7.4.2213), Vim allows to highlight the filler lines after the last line in a buffer using a separate highlighting group called EndOfBuffer:

:highlight EndOfBuffer ctermfg=bg guifg=bg
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜