Nvim-tree.lua: Background color

Created on 23 Mar 2021  路  8Comments  路  Source: kyazdani42/nvim-tree.lua

Is it possible to set a custom background color only for the tree?

Most helpful comment

I was wondering that as well. NvimTreNormal makes no difference whatsoever.

I was able to change it setting this autocmd, in case it helps you:

autocmd ColorScheme * highlight highlight NvimTreeBg guibg=#2B4252
autocmd FileType NvimTree setlocal winhighlight=Normal:NvimTreeBg

2021-03-31_22-11

All 8 comments

hum used to be the case but i did not manage to do it. I'm pushing a fix to set back the winhighlight (don't know why it wasn't set anymore).
I'm going to investigate because i cannot manage to override the link from the plugin in my configs ...

well i have no clue why, but i cannot manage to set NvimTreeNormal in my configs (but i can in the plugin source), the group is always cleared no matter where i put i in my config. I'll come back here if i can understand why this happens ...

I was wondering that as well. NvimTreNormal makes no difference whatsoever.

I was able to change it setting this autocmd, in case it helps you:

autocmd ColorScheme * highlight highlight NvimTreeBg guibg=#2B4252
autocmd FileType NvimTree setlocal winhighlight=Normal:NvimTreeBg

2021-03-31_22-11

this was fixed in the view refactoring, you can now set NvimTreeNormal and it works fine :)

@kyazdani42 I just tried this out, I'd been using a similar winhighlight override for a while anyway. From looking at the current implementation though it seems to set winhighlight like

EndOfBuffer:NvimTreeEndOfBuffer,Normal:NvimTreeNormal,CursorLine:NvimTreeCursorLine,VertSplit:NvimTreeVertSplit,SignColumn:Normal

This means that for me anyway I see that signcolumn is highlighted the same as the normal buffer but not the same as the rest of the tree. I think SignColumn:Normal should be SignColumn:NvimTreeNormal.

indeed, just fixed that in latest master

When I open a new tab from nvim-tree after setting as below, the background color of the new tab is strange(same as NvimTreeNormal)
vim.cmd("autocmd Colorscheme * highlight NvimTreeNormal guibg=#21252B guifg=#9da5b3")

@yamatsum this is another issue that i don't know how to tackle but bothers me too, you can follow that in #290

Was this page helpful?
0 / 5 - 0 ratings