* fix(#2643): correctly apply linked highlight groups in tree window * fix(#2643): recreate and apply combined highlight groups on colorscheme change
This commit is contained in:
committed by
GitHub
parent
7bdb220d0f
commit
fbee8a69a4
@@ -1,4 +1,3 @@
|
||||
local appearance = require "nvim-tree.appearance"
|
||||
local events = require "nvim-tree.events"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local log = require "nvim-tree.log"
|
||||
@@ -39,6 +38,19 @@ M.View = {
|
||||
cursorlineopt = "both",
|
||||
colorcolumn = "0",
|
||||
wrap = false,
|
||||
winhl = table.concat({
|
||||
"EndOfBuffer:NvimTreeEndOfBuffer",
|
||||
"CursorLine:NvimTreeCursorLine",
|
||||
"CursorLineNr:NvimTreeCursorLineNr",
|
||||
"LineNr:NvimTreeLineNr",
|
||||
"WinSeparator:NvimTreeWinSeparator",
|
||||
"StatusLine:NvimTreeStatusLine",
|
||||
"StatusLineNC:NvimTreeStatuslineNC",
|
||||
"SignColumn:NvimTreeSignColumn",
|
||||
"Normal:NvimTreeNormal",
|
||||
"NormalNC:NvimTreeNormalNC",
|
||||
"NormalFloat:NvimTreeNormalFloat",
|
||||
}, ","),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -135,9 +147,6 @@ local function set_window_options_and_buffer()
|
||||
vim.opt_local[k] = v
|
||||
end
|
||||
vim.opt.eventignore = eventignore
|
||||
|
||||
-- use highlights from the nvim_tree namespace
|
||||
vim.api.nvim_win_set_hl_ns(M.get_winnr(), appearance.NS_ID)
|
||||
end
|
||||
|
||||
---@return table
|
||||
@@ -530,6 +539,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() and vim.api.nvim_win_is_valid(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.centralize_selection = options.centralize_selection
|
||||
|
||||
Reference in New Issue
Block a user