How to change the color of the tilde or EndOfBuffer in neovim

341 Views Asked by At

I'm trying to change the color of the '~' at the end of buffer line in neovim. I couldn't find any answer until I tested all I could and found a solution.

(Posting in answer).

1

There are 1 best solutions below

0
arturfil On

If you want to override the theme and set the color of the '~' at the end of file (EndOfBuffer), you have to add this command in your lua neovim theme.lua or which ever file you use to have it configured.

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c"} ) -- overrides `~` character at the end of buffer

You can do similar things for the background window and the number line, here added in case you are curious:

-- vim.api.nvim_set_hl(0, "LineNr", { fg = "#716682" }) -- use this w/ kanagawa, overrides number line color
vim.api.nvim_set_hl(0, "Normal", { bg = "#101e2c"}) -- use this for night-owl, overrides background of windows

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c"} ) -- overrides `~` character at the end of buffer