Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color of the tilde characters indicating the filler lines after the last line of a buffer in Vim?

Tags:

vim

When Vim starts, it displays the tilde symbol (~) for empty lines. Is there a way to change its color?

like image 825
grigoryvp Avatar asked Aug 18 '09 15:08

grigoryvp


5 Answers

Try this:

:highlight NonText ctermfg=12

12 is the default color; change as you see fit.

like image 91
Lucas Oman Avatar answered Oct 11 '22 14:10

Lucas Oman


In Vim 8, you can set the EndOfBuffer highlight group separately from NonText:

highlight EndOfBuffer ctermfg=bg
like image 38
Neal Fultz Avatar answered Oct 11 '22 12:10

Neal Fultz


I can't leave comments yet, so this will have to be an answer..

Lucas is correct, but you must remember that this will also change the color of the characters shown when you :set list. If you are attempting to hide these tildes, you will also hide those characters.

like image 39
Randy Morris Avatar answered Oct 11 '22 14:10

Randy Morris


Lucas is right but if you want to change the colour in gvim as well I think you need guifg= as well as ctermfg=

i.e. :highlight NonText ctermfg=*color* guifg=*color*

like image 45
mikej Avatar answered Oct 11 '22 13:10

mikej


For standard Vim 8.x, the following works:

:highlight EndOfBuffer ctermfg=*color*

This colors tildes at the end of buffers into a specifically determined color.

For gVim 8.x, the following is smoother:

:highlight EndOfBuffer guifg=bg

This is better since it colors tildes at the end of buffers into the color of the background, effectively making such tildes transparent.

like image 22
Paul Kim Avatar answered Oct 11 '22 12:10

Paul Kim