background colour issue with Sonokai
marene opened this issue · comments
Description
First of all, thanks again for this plugin, you've done an amazing work!
Here is the issue:
When I start neovim in a terminal
And I set the colorscheme to sonokai
And I open nvim-tree with :NvimTreeOpen
Then the background colour of the filetree is different than the background colour of the other windows.
The issue seems to be coming from the NvimTreeNormal
hl group not being linked properly to the Normal
group:
Normal xxx ctermfg=250 ctermbg=235
NvimTreeNormal xxx ctermfg=250 ctermbg=232
After having a look around the code, I found that when this line is changed to
vim.api.nvim_command("hi! def link NvimTree" .. k .. " " .. d)
(notice the <bang>
added to the :hi
command), then it the highlight group NvimTreeNormal
gets linked to Normal
with all the expected colours and the filetree displays as expected.
Not forcing the highlight groups link may have been a conscious decision to avoid nvim-tree messing with potentially pre-existing groups, but if that's the case then I am not sure how we could go about fixing it.
I'd be more than happy to help with this issue if needed!
Neovim version
NVIM v0.8.3
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /Library/Developer/CommandLineTools/usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/Users/marene/neovim/build/cmake.config -I/Users/marene/neovim/src -I/Users/marene/neovim/.deps/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include -I/opt/homebrew/opt/gettext/include -I/Users/marene/neovim/build/src/nvim/auto -I/Users/marene/neovim/build/include
Compiled by marene@Matthieus-MacBook-Pro-2.local
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
Operating system and version
macOS 12.6.1
nvim-tree version
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
"sainnhe/sonokai",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
}
end
if vim.fn.isdirectory(install_path) == 0 then
print "Installing nvim-tree and dependencies."
vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup {}
end
Steps to reproduce
- nvim -nu /tmp/nvt-min.lu
- :colorscheme sonokai
- :NvimTreeOpen
Expected behavior
the ctermbg
of the nvim-tree window should be the same than for the rest of the windows.
Actual behavior
The background color of the file tree is different than the rest of the windows.
I believe the relevant highlight groups are:
Normal xxx ctermfg=250 ctermbg=235
NvimTreeNormal xxx ctermfg=250 ctermbg=232
sonokai
NvimTreeNormal xxx ctermfg=250 ctermbg=232 guifg=#e2e2e3 guibg=#222327
Normal xxx ctermfg=250 ctermbg=235 guifg=#e2e2e3 guibg=#2c2e34
default
NvimTreeNormal xxx links to Normal
Normal xxx cleared
sonokai is setting these colours: https://github.com/sainnhe/sonokai/blob/296f7fa3432f7d9b55b27ad0023f8824701cfec4/colors/sonokai.vim#L1396
mini.base16 does something similar. I overrode some of those: https://github.com/alex-courtis/arch/blob/a82926db74315757455b80ceef0652ffb321d1aa/config/nvim/lua/amc/init/appearance.lua#L29