Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

Currently, when my window is 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?

like image 625
lukerandall Avatar asked Sep 16 '10 09:09

lukerandall


2 Answers

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
like image 105
fvgs Avatar answered Nov 19 '22 05:11

fvgs


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
like image 22
ib. Avatar answered Nov 19 '22 05:11

ib.