Add empty directory highlight group
This commit is contained in:
committed by
Kiyan
parent
6647f96739
commit
9650c0ed9d
@@ -92,7 +92,7 @@ end
|
|||||||
|
|
||||||
function M.unroll_dir(node)
|
function M.unroll_dir(node)
|
||||||
node.open = not node.open
|
node.open = not node.open
|
||||||
if node.children_initial then node.children_initial = false end
|
if node.has_children then node.has_children = false end
|
||||||
if #node.entries > 0 then
|
if #node.entries > 0 then
|
||||||
renderer.draw(M.Tree, true)
|
renderer.draw(M.Tree, true)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ local function dir_new(cwd, name)
|
|||||||
match_name = path_to_matching_str(name),
|
match_name = path_to_matching_str(name),
|
||||||
match_path = path_to_matching_str(absolute_path),
|
match_path = path_to_matching_str(absolute_path),
|
||||||
open = false,
|
open = false,
|
||||||
children_initial = has_children,
|
has_children = has_children,
|
||||||
entries = {}
|
entries = {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -238,10 +238,13 @@ local function update_draw_data(tree, depth, markers)
|
|||||||
local git_hl = get_git_hl(node)
|
local git_hl = get_git_hl(node)
|
||||||
|
|
||||||
if node.entries then
|
if node.entries then
|
||||||
local icon = get_folder_icon(node.open, node.link_to ~= nil, #node.entries ~= 0 or node.children_initial)
|
local has_children = #node.entries ~= 0 or node.has_children
|
||||||
|
local icon = get_folder_icon(node.open, node.link_to ~= nil, has_children)
|
||||||
local git_icon = get_git_icons(node, index, offset, #icon+1) or ""
|
local git_icon = get_git_icons(node, index, offset, #icon+1) or ""
|
||||||
-- INFO: this is mandatory in order to keep gui attributes (bold/italics)
|
-- INFO: this is mandatory in order to keep gui attributes (bold/italics)
|
||||||
set_folder_hl(index, offset, #icon, #node.name+#git_icon, 'NvimTreeFolderName')
|
local folder_hl = "NvimTreeFolderName"
|
||||||
|
if not has_children then folder_hl = "NvimTreeEmptyFolderName" end
|
||||||
|
set_folder_hl(index, offset, #icon, #node.name+#git_icon, folder_hl)
|
||||||
if git_hl then
|
if git_hl then
|
||||||
set_folder_hl(index, offset, #icon, #node.name+#git_icon, git_hl)
|
set_folder_hl(index, offset, #icon, #node.name+#git_icon, git_hl)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user