From 65c2ba895213c3641fc58dd33bc7a44423a6cdbe Mon Sep 17 00:00:00 2001 From: kiyan Date: Fri, 28 Oct 2022 14:19:01 +0200 Subject: [PATCH] fix(colorscheme): update winhl on colorscheme change fixes #1696 --- lua/nvim-tree.lua | 1 + lua/nvim-tree/view.lua | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 3eec3114..b87a2e48 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -192,6 +192,7 @@ end function M.reset_highlight() colors.setup() + view.reset_winhl() renderer.render_hl(view.get_bufnr()) end diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index eb38b015..9df2e3ab 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -436,6 +436,13 @@ function M.is_root_folder_visible(cwd) return cwd ~= "/" and not M.View.hide_root_folder end +-- used on ColorScheme event +function M.reset_winhl() + if M.get_winnr() then + vim.wo[M.get_winnr()].winhl = M.View.winopts.winhl + end +end + function M.setup(opts) local options = opts.view or {} M.View.adaptive_size = options.adaptive_size