Feat/icon highlighting for opened files and directories (#258)

This commit is contained in:
Carlos Afonso
2021-04-13 15:12:21 -03:00
committed by GitHub
parent 82b20f5b5e
commit c2f2c665d8
4 changed files with 18 additions and 0 deletions

View File

@@ -261,6 +261,7 @@ local function update_draw_data(tree, depth, markers)
next = next.group_next
end
if not has_children then folder_hl = "NvimTreeEmptyFolderName" end
if node.open then folder_hl = "NvimTreeOpenedFolderName" end
set_folder_hl(index, offset, #icon, #name+#git_icon, folder_hl)
if git_hl then
set_folder_hl(index, offset, #icon, #name+#git_icon, git_hl)
@@ -298,6 +299,12 @@ local function update_draw_data(tree, depth, markers)
table.insert(hl, {'NvimTreeImageFile', index, offset+#icon+#git_icons, -1 })
end
if vim.g.nvim_tree_highlight_opened_files then
if vim.fn.bufloaded(node.absolute_path) > 0 then
table.insert(hl, {'NvimTreeOpenedFile', index, offset, offset+#icon })
end
end
if git_hl then
table.insert(hl, {git_hl, index, offset+#icon+#git_icons, -1 })
end