From 5736db5db3d21f0a6fd90a0d71b45eabd86b04d8 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Wed, 30 Nov 2022 03:35:00 +1100 Subject: [PATCH 01/16] coding style --- lua/nvim-tree/explorer/common.lua | 15 ++-- lua/nvim-tree/renderer/components/git.lua | 92 +++++++++-------------- 2 files changed, 44 insertions(+), 63 deletions(-) diff --git a/lua/nvim-tree/explorer/common.lua b/lua/nvim-tree/explorer/common.lua index 71eae8af608..5f773fac7db 100644 --- a/lua/nvim-tree/explorer/common.lua +++ b/lua/nvim-tree/explorer/common.lua @@ -22,20 +22,19 @@ function M.has_one_child_folder(node) end function M.update_git_status(node, parent_ignored, status) - -- status of the node's absolute path + local get_status if node.nodes then - node.git_status = get_dir_git_status(parent_ignored, status, node.absolute_path) + get_status = get_dir_git_status else - node.git_status = get_git_status(parent_ignored, status, node.absolute_path) + get_status = get_git_status end + -- status of the node's absolute path + node.git_status = get_status(parent_ignored, status, node.absolute_path) + -- status of the link target, if the link itself is not dirty if node.link_to and not node.git_status then - if node.nodes then - node.git_status = get_dir_git_status(parent_ignored, status, node.link_to) - else - node.git_status = get_git_status(parent_ignored, status, node.link_to) - end + node.git_status = get_status(parent_ignored, status, node.link_to) end end diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index fae22803f30..64a97b52cae 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -6,63 +6,45 @@ local M = { } local function build_icons_table(i) + local icons = { + staged = { icon = i.staged, hl = "NvimTreeGitStaged" }, + unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" }, + untracked = { icon = i.untracked, hl = "NvimTreeGitNew" }, + unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" }, + deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" }, + ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" }, + } return { - ["M "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } }, - [" M"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } }, - ["C "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } }, - [" C"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } }, - ["CM"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } }, - [" T"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } }, - ["T "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } }, - ["MM"] = { - { icon = i.staged, hl = "NvimTreeGitStaged" }, - { icon = i.unstaged, hl = "NvimTreeGitDirty" }, - }, - ["MD"] = { - { icon = i.staged, hl = "NvimTreeGitStaged" }, - }, - ["A "] = { - { icon = i.staged, hl = "NvimTreeGitStaged" }, - }, - ["AD"] = { - { icon = i.staged, hl = "NvimTreeGitStaged" }, - }, - [" A"] = { - { icon = i.untracked, hl = "NvimTreeGitNew" }, - }, + ["M "] = { icons.staged }, + [" M"] = { icons.unstaged }, + ["C "] = { icons.staged }, + [" C"] = { icons.unstaged }, + ["CM"] = { icons.unstaged }, + [" T"] = { icons.unstaged }, + ["T "] = { icons.staged }, + ["MM"] = { icons.staged, icons.unstaged }, + ["MD"] = { icons.staged }, + ["A "] = { icons.staged }, + ["AD"] = { icons.staged }, + [" A"] = { icons.untracked }, -- not sure about this one - ["AA"] = { - { icon = i.unmerged, hl = "NvimTreeGitMerge" }, - { icon = i.untracked, hl = "NvimTreeGitNew" }, - }, - ["AU"] = { - { icon = i.unmerged, hl = "NvimTreeGitMerge" }, - { icon = i.untracked, hl = "NvimTreeGitNew" }, - }, - ["AM"] = { - { icon = i.staged, hl = "NvimTreeGitStaged" }, - { icon = i.unstaged, hl = "NvimTreeGitDirty" }, - }, - ["??"] = { { icon = i.untracked, hl = "NvimTreeGitNew" } }, - ["R "] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } }, - [" R"] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } }, - ["RM"] = { - { icon = i.unstaged, hl = "NvimTreeGitDirty" }, - { icon = i.renamed, hl = "NvimTreeGitRenamed" }, - }, - ["UU"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } }, - ["UD"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } }, - ["UA"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } }, - [" D"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } }, - ["D "] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } }, - ["RD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } }, - ["DD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } }, - ["DU"] = { - { icon = i.deleted, hl = "NvimTreeGitDeleted" }, - { icon = i.unmerged, hl = "NvimTreeGitMerge" }, - }, - ["!!"] = { { icon = i.ignored, hl = "NvimTreeGitIgnored" } }, - dirty = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } }, + ["AA"] = { icons.unmerged, icons.untracked }, + ["AU"] = { icons.unmerged, icons.untracked }, + ["AM"] = { icons.staged, icons.unstaged }, + ["??"] = { icons.untracked }, + ["R "] = { icons.renamed }, + [" R"] = { icons.renamed }, + ["RM"] = { icons.unstaged, icons.renamed }, + ["UU"] = { icons.unmerged }, + ["UD"] = { icons.unmerged }, + ["UA"] = { icons.unmerged }, + [" D"] = { icons.deleted }, + ["D "] = { icons.deleted }, + ["RD"] = { icons.deleted }, + ["DD"] = { icons.deleted }, + ["DU"] = { icons.deleted, icons.unmerged }, + ["!!"] = { icons.ignored }, + dirty = { icons.unstaged }, } end From cd1df4f9bfd0668716a8240e21b73f998b1c6d70 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Wed, 30 Nov 2022 03:39:44 +1100 Subject: [PATCH 02/16] outlined git.show_on_open_dirs behavior --- doc/nvim-tree-lua.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 436baf3591b..15147797e26 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -592,7 +592,9 @@ Git integration with icons and colors. Type: `boolean`, Default: `true` *nvim-tree.git.show_on_open_dirs* - Show status icons on directories that are open. + Show status icons of children on directories that are open. + Note that setting this to `false` will still show ignored icon on ignored + directories and deleted icons on directories whose children are deleted. Only relevant when `git.show_on_dirs` is `true`. Type: `boolean`, Default: `true` From f65dc0d4e3279df0b5d29f709f216f8456eb1606 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 21:09:35 +1100 Subject: [PATCH 03/16] show some icon on opendir even if show_on_open_dir=false and show all children's status on parent --- lua/nvim-tree/actions/moves/item.lua | 2 +- lua/nvim-tree/actions/reloaders/reloaders.lua | 2 + lua/nvim-tree/explorer/common.lua | 100 ++++++++++++++---- lua/nvim-tree/explorer/explore.lua | 2 +- lua/nvim-tree/explorer/reload.lua | 2 +- lua/nvim-tree/git/init.lua | 13 +-- lua/nvim-tree/git/utils.lua | 35 ++++-- lua/nvim-tree/renderer/components/git.lua | 34 ++++-- 8 files changed, 140 insertions(+), 50 deletions(-) diff --git a/lua/nvim-tree/actions/moves/item.lua b/lua/nvim-tree/actions/moves/item.lua index b5646193346..0bd064de0fe 100644 --- a/lua/nvim-tree/actions/moves/item.lua +++ b/lua/nvim-tree/actions/moves/item.lua @@ -15,7 +15,7 @@ function M.fn(where, what) for line, node in pairs(nodes_by_line) do local valid = false if what == "git" then - valid = explorer_common.shows_git_status(node) + valid = explorer_common.get_git_status(node) ~= nil elseif what == "diag" then valid = node.diag_status ~= nil end diff --git a/lua/nvim-tree/actions/reloaders/reloaders.lua b/lua/nvim-tree/actions/reloaders/reloaders.lua index 7fca29068d1..78f6cb31016 100644 --- a/lua/nvim-tree/actions/reloaders/reloaders.lua +++ b/lua/nvim-tree/actions/reloaders/reloaders.lua @@ -20,6 +20,8 @@ end function M.reload_node_status(parent_node, projects) local project_root = git.get_project_root(parent_node.absolute_path) local status = projects[project_root] or {} + require("nvim-tree.log").line("dev", "reloaders") + -- TODO: when is this called for _, node in ipairs(parent_node.nodes) do if node.nodes then node.git_status = status.dirs and status.dirs[node.absolute_path] diff --git a/lua/nvim-tree/explorer/common.lua b/lua/nvim-tree/explorer/common.lua index 5f773fac7db..d433ef4e1c8 100644 --- a/lua/nvim-tree/explorer/common.lua +++ b/lua/nvim-tree/explorer/common.lua @@ -1,20 +1,31 @@ local M = {} +-- node.git_status structure: +-- { +-- file = string | nil, +-- dir = { +-- direct = { string } | nil, +-- indirect = { string } | nil, +-- } | nil, +-- } + local function get_dir_git_status(parent_ignored, status, absolute_path) if parent_ignored then - return "!!" - end - - local file_status = status.files and status.files[absolute_path] - if file_status then - return file_status + return { file = "!!" } end - return status.dirs and status.dirs[absolute_path] + return { + file = status.files and status.files[absolute_path], + dir = { + direct = status.dirs.direct[absolute_path], + indirect = status.dirs.indirect[absolute_path], + }, + } end local function get_git_status(parent_ignored, status, absolute_path) - return parent_ignored and "!!" or status.files and status.files[absolute_path] + local file_status = parent_ignored and "!!" or status.files and status.files[absolute_path] + return { file = file_status } end function M.has_one_child_folder(node) @@ -38,20 +49,71 @@ function M.update_git_status(node, parent_ignored, status) end end -function M.shows_git_status(node) - if not node.git_status then +function M.get_git_status(node) + local git_status = node.git_status + if not git_status then -- status doesn't exist - return false - elseif not node.nodes then - -- status exist and is a file - return true - elseif not node.open then - -- status exist, is a closed dir - return M.config.git.show_on_dirs + return nil + end + + if not node.nodes then + -- file + return git_status.file and { git_status.file } + end + + -- dir + if not M.config.git.show_on_dirs then + return nil + end + + local status = {} + if not node.open or M.config.git.show_on_open_dirs then + -- dir is closed or we should show on open_dirs + if git_status.file ~= nil then + table.insert(status, git_status.file) + end + if git_status.dir ~= nil then + if git_status.dir.direct ~= nil then + for _, s in pairs(node.git_status.dir.direct) do + table.insert(status, s) + end + end + if git_status.dir.indirect ~= nil then + for _, s in pairs(node.git_status.dir.indirect) do + table.insert(status, s) + end + end + end else - -- status exist, is a open dir - return M.config.git.show_on_dirs and M.config.git.show_on_open_dirs + -- dir is open and we shouldn't show on open_dirs + if git_status.file ~= nil then + table.insert(status, git_status.file) + end + if git_status.dir ~= nil and git_status.dir.direct ~= nil then + local deleted = { + [" D"] = true, + ["D "] = true, + ["RD"] = true, + ["DD"] = true, + -- TODO: test if this should be deleted + ["DU"] = true, + } + for _, s in pairs(node.git_status.dir.direct) do + if deleted[s] then + table.insert(status, s) + end + end + end end + if #status == 0 then + return nil + else + return status + end +end + +function M.is_git_ignored(node) + return node.git_status and node.git_status.file == "!!" end function M.node_destroy(node) diff --git a/lua/nvim-tree/explorer/explore.lua b/lua/nvim-tree/explorer/explore.lua index da0803c8419..81c6713d5f9 100644 --- a/lua/nvim-tree/explorer/explore.lua +++ b/lua/nvim-tree/explorer/explore.lua @@ -13,7 +13,7 @@ local function get_type_from(type_, cwd) end local function populate_children(handle, cwd, node, git_status) - local node_ignored = node.git_status == "!!" + local node_ignored = common.is_git_ignored(node) local nodes_by_path = utils.bool_record(node.nodes, "absolute_path") local filter_status = filters.prepare(git_status) while true do diff --git a/lua/nvim-tree/explorer/reload.lua b/lua/nvim-tree/explorer/reload.lua index 8f1a3384153..3d3dda5d8f8 100644 --- a/lua/nvim-tree/explorer/reload.lua +++ b/lua/nvim-tree/explorer/reload.lua @@ -53,7 +53,7 @@ function M.reload(node, git_status, unloaded_bufnr) local child_names = {} - local node_ignored = node.git_status == "!!" + local node_ignored = common.is_git_ignored(node) local nodes_by_path = utils.key_by(node.nodes, "absolute_path") while true do local ok, name, t = pcall(vim.loop.fs_scandir_next, handle) diff --git a/lua/nvim-tree/git/init.lua b/lua/nvim-tree/git/init.lua index e16169503fb..35c680b9cb8 100644 --- a/lua/nvim-tree/git/init.lua +++ b/lua/nvim-tree/git/init.lua @@ -4,6 +4,7 @@ local git_utils = require "nvim-tree.git.utils" local Runner = require "nvim-tree.git.runner" local Watcher = require("nvim-tree.watcher").Watcher local Iterator = require "nvim-tree.iterators.node-iterator" +local explorer_common = require "nvim-tree.explorer.common" local M = { config = {}, @@ -103,19 +104,13 @@ local function reload_tree_at(project_root) end M.reload_project(project_root) - local project = M.get_project(project_root) - - local project_files = project.files and project.files or {} - local project_dirs = project.dirs and project.dirs or {} + local git_status = M.get_project(project_root) Iterator.builder(root_node.nodes) :hidden() :applier(function(node) - local parent_ignored = node.parent.git_status == "!!" - node.git_status = project_dirs[node.absolute_path] or project_files[node.absolute_path] - if not node.git_status and parent_ignored then - node.git_status = "!!" - end + local parent_ignored = explorer_common.is_git_ignored(node.parent) + explorer_common.update_git_status(node, parent_ignored, git_status) end) :recursor(function(node) return node.nodes and #node.nodes > 0 and node.nodes diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua index 48074c08f6e..e14cdafca40 100644 --- a/lua/nvim-tree/git/utils.lua +++ b/lua/nvim-tree/git/utils.lua @@ -55,24 +55,43 @@ function M.should_show_untracked(cwd) return untracked[cwd] end +local function nil_insert(t, k) + t = t or {} + t[k] = true + return t +end + function M.file_status_to_dir_status(status, cwd) - local dirs = {} + local direct = {} for p, s in pairs(status) do if s ~= "!!" then local modified = vim.fn.fnamemodify(p, ":h") - dirs[modified] = s + direct[modified] = nil_insert(direct[modified], s) end end - for dirname, s in pairs(dirs) do - local modified = dirname - while modified ~= cwd and modified ~= "/" do - modified = vim.fn.fnamemodify(modified, ":h") - dirs[modified] = s + local indirect = {} + for dirname, statuses in pairs(direct) do + for s, _ in pairs(statuses) do + local modified = dirname + while modified ~= cwd and modified ~= "/" do + modified = vim.fn.fnamemodify(modified, ":h") + indirect[modified] = nil_insert(indirect[modified], s) + end end end - return dirs + local r = { indirect = indirect, direct = direct } + for _, d in pairs(r) do + for dirname, statuses in pairs(d) do + local new_statuses = {} + for s, _ in pairs(statuses) do + table.insert(new_statuses, s) + end + d[dirname] = new_statuses + end + end + return r end return M diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 64a97b52cae..8846b3baf64 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -59,20 +59,32 @@ local function warn_status(git_status) end local function get_icons_(node) - if not explorer_common.shows_git_status(node) then + local git_statuses = explorer_common.get_git_status(node) + if git_statuses == nil then return nil end - local git_status = node.git_status - local icons = M.git_icons[git_status] - if not icons then - if not M.config.highlight_git then - warn_status(git_status) + local inserted = {} + local iconss = {} + + for _, git_status in pairs(git_statuses) do + local icons = M.git_icons[git_status] + if not icons then + if not M.config.highlight_git then + warn_status(git_status) + end + return nil + end + + for _, icon in pairs(icons) do + if not inserted[icon] then + table.insert(iconss, icon) + inserted[icon] = true + end end - return nil end - return icons + return iconss end local git_hl = { @@ -119,12 +131,12 @@ function M.setup_signs(i) end local function get_highlight_(node) - local git_status = node.git_status - if not explorer_common.shows_git_status(node) then + local git_status = explorer_common.get_git_status(node) + if git_status == nil then return end - return git_hl[git_status] + return git_hl[git_status[1]] end function M.setup(opts) From 5c6acd554e072b1954efa022cd262e3c5a11a08d Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 21:36:58 +1100 Subject: [PATCH 04/16] fixed renamed icon not showing --- lua/nvim-tree/renderer/components/git.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 8846b3baf64..44dadc0dffe 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -11,6 +11,7 @@ local function build_icons_table(i) unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" }, untracked = { icon = i.untracked, hl = "NvimTreeGitNew" }, unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" }, + renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" }, deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" }, ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" }, } From 75cd0d1a6d4af4713f0cd82310a768cc02413efb Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 22:15:06 +1100 Subject: [PATCH 05/16] sorted icons --- lua/nvim-tree/renderer/components/git.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 44dadc0dffe..045842bf67f 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -7,13 +7,13 @@ local M = { local function build_icons_table(i) local icons = { - staged = { icon = i.staged, hl = "NvimTreeGitStaged" }, - unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" }, - untracked = { icon = i.untracked, hl = "NvimTreeGitNew" }, - unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" }, - renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" }, - deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" }, - ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" }, + staged = { icon = i.staged, hl = "NvimTreeGitStaged", ord = 1 }, + unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty", ord = 2 }, + renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed", ord = 3 }, + deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted", ord = 4 }, + unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge", ord = 5 }, + untracked = { icon = i.untracked, hl = "NvimTreeGitNew", ord = 6 }, + ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored", ord = 7 }, } return { ["M "] = { icons.staged }, @@ -85,6 +85,8 @@ local function get_icons_(node) end end + table.sort(iconss, function(a, b) return a.ord < b.ord end) + return iconss end From ac8fb08f900cba78a2bbce708fab5d35d0ba093a Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 22:20:59 +1100 Subject: [PATCH 06/16] removed DU from deleted as file will show up in tree --- lua/nvim-tree/explorer/common.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/nvim-tree/explorer/common.lua b/lua/nvim-tree/explorer/common.lua index d433ef4e1c8..69bf90d636b 100644 --- a/lua/nvim-tree/explorer/common.lua +++ b/lua/nvim-tree/explorer/common.lua @@ -95,8 +95,6 @@ function M.get_git_status(node) ["D "] = true, ["RD"] = true, ["DD"] = true, - -- TODO: test if this should be deleted - ["DU"] = true, } for _, s in pairs(node.git_status.dir.direct) do if deleted[s] then From a342de09490b529b12f9a6202e8f04f024ee148a Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 22:34:50 +1100 Subject: [PATCH 07/16] fixed update_git_status in reloaders not tested --- lua/nvim-tree/actions/reloaders/reloaders.lua | 9 ++------- lua/nvim-tree/renderer/components/git.lua | 4 +++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lua/nvim-tree/actions/reloaders/reloaders.lua b/lua/nvim-tree/actions/reloaders/reloaders.lua index 78f6cb31016..16e6325f17c 100644 --- a/lua/nvim-tree/actions/reloaders/reloaders.lua +++ b/lua/nvim-tree/actions/reloaders/reloaders.lua @@ -3,6 +3,7 @@ local view = require "nvim-tree.view" local renderer = require "nvim-tree.renderer" local explorer_module = require "nvim-tree.explorer" local core = require "nvim-tree.core" +local explorer_common = require "nvim-tree.explorer.common" local M = {} @@ -20,14 +21,8 @@ end function M.reload_node_status(parent_node, projects) local project_root = git.get_project_root(parent_node.absolute_path) local status = projects[project_root] or {} - require("nvim-tree.log").line("dev", "reloaders") - -- TODO: when is this called for _, node in ipairs(parent_node.nodes) do - if node.nodes then - node.git_status = status.dirs and status.dirs[node.absolute_path] - else - node.git_status = status.files and status.files[node.absolute_path] - end + explorer_common.update_git_status(node, explorer_common.is_git_ignored(parent_node), status) if node.nodes and #node.nodes > 0 then M.reload_node_status(node, projects) end diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 045842bf67f..65e49e77edd 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -85,7 +85,9 @@ local function get_icons_(node) end end - table.sort(iconss, function(a, b) return a.ord < b.ord end) + table.sort(iconss, function(a, b) + return a.ord < b.ord + end) return iconss end From 3af4d14199589f9450e6ba9ecada11979ea95c49 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 22:47:04 +1100 Subject: [PATCH 08/16] fixed Api.git.reload() Tested update_git_status in reloaders.lua --- lua/nvim-tree/actions/reloaders/reloaders.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/actions/reloaders/reloaders.lua b/lua/nvim-tree/actions/reloaders/reloaders.lua index 16e6325f17c..b8bf9057225 100644 --- a/lua/nvim-tree/actions/reloaders/reloaders.lua +++ b/lua/nvim-tree/actions/reloaders/reloaders.lua @@ -47,7 +47,7 @@ function M.reload_explorer(_, unloaded_bufnr) end function M.reload_git() - if not core.get_explorer() or not git.config.enable or event_running then + if not core.get_explorer() or not git.config.git.enable or event_running then return end event_running = true From 10fc0ebf904a135724d74dda6f3b8402fabb56c5 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 6 Dec 2022 23:56:12 +1100 Subject: [PATCH 09/16] sort icon only if not git signcolumn --- lua/nvim-tree/renderer/builder.lua | 15 +++++++++++---- lua/nvim-tree/renderer/components/git.lua | 4 ---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lua/nvim-tree/renderer/builder.lua b/lua/nvim-tree/renderer/builder.lua index 1a63900e989..52657bab810 100644 --- a/lua/nvim-tree/renderer/builder.lua +++ b/lua/nvim-tree/renderer/builder.lua @@ -248,10 +248,17 @@ function Builder:_build_line(node, idx, num_children) local git_highlight = git.get_highlight(node) local git_icons_tbl = git.get_icons(node) - if self.is_git_sign and git_icons_tbl and #git_icons_tbl > 0 then - local git_info = git_icons_tbl[1] - table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) - git_icons_tbl = {} + if git_icons_tbl and #git_icons_tbl > 0 then + if self.is_git_sign then + local git_info = git_icons_tbl[1] + table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) + git_icons_tbl = {} + else + -- sort icons so it looks slightly better + table.sort(git_icons_tbl, function(a, b) + return a.ord < b.ord + end) + end end local is_folder = node.nodes ~= nil diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 65e49e77edd..95115f3ff09 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -85,10 +85,6 @@ local function get_icons_(node) end end - table.sort(iconss, function(a, b) - return a.ord < b.ord - end) - return iconss end From 627dde9960c2dcc83c70dd873c26f46adbd3e9db Mon Sep 17 00:00:00 2001 From: chomosuke Date: Wed, 7 Dec 2022 18:59:40 +1100 Subject: [PATCH 10/16] fixed crashing when root dir isn't git dir --- lua/nvim-tree/explorer/common.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/explorer/common.lua b/lua/nvim-tree/explorer/common.lua index 69bf90d636b..0a3b9f3f941 100644 --- a/lua/nvim-tree/explorer/common.lua +++ b/lua/nvim-tree/explorer/common.lua @@ -16,7 +16,7 @@ local function get_dir_git_status(parent_ignored, status, absolute_path) return { file = status.files and status.files[absolute_path], - dir = { + dir = status.dirs and { direct = status.dirs.direct[absolute_path], indirect = status.dirs.indirect[absolute_path], }, From bdc2c70a6d988ac6177a5b64372dfc098e3f156b Mon Sep 17 00:00:00 2001 From: chomosuke Date: Mon, 12 Dec 2022 22:32:28 +1300 Subject: [PATCH 11/16] made git.show_on_dirs doc more concise --- doc/nvim-tree-lua.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 15147797e26..a224f4f61cc 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -593,8 +593,6 @@ Git integration with icons and colors. *nvim-tree.git.show_on_open_dirs* Show status icons of children on directories that are open. - Note that setting this to `false` will still show ignored icon on ignored - directories and deleted icons on directories whose children are deleted. Only relevant when `git.show_on_dirs` is `true`. Type: `boolean`, Default: `true` From 23d41136ee4fa52fd079d8dd08fe2844b3f8965e Mon Sep 17 00:00:00 2001 From: chomosuke Date: Mon, 12 Dec 2022 22:37:32 +1300 Subject: [PATCH 12/16] git_statuses -> git_status for consistency --- lua/nvim-tree/explorer/init.lua | 4 ++-- lua/nvim-tree/renderer/components/git.lua | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/nvim-tree/explorer/init.lua b/lua/nvim-tree/explorer/init.lua index 8f34f9d7b38..437ba94ff58 100644 --- a/lua/nvim-tree/explorer/init.lua +++ b/lua/nvim-tree/explorer/init.lua @@ -24,8 +24,8 @@ end function Explorer:_load(node) local cwd = node.link_to or node.absolute_path - local git_statuses = git.load_project_status(cwd) - M.explore(node, git_statuses) + local git_status = git.load_project_status(cwd) + M.explore(node, git_status) end function Explorer:expand(node) diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 95115f3ff09..f6da7eb1dc6 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -60,19 +60,19 @@ local function warn_status(git_status) end local function get_icons_(node) - local git_statuses = explorer_common.get_git_status(node) - if git_statuses == nil then + local git_status = explorer_common.get_git_status(node) + if git_status == nil then return nil end local inserted = {} local iconss = {} - for _, git_status in pairs(git_statuses) do - local icons = M.git_icons[git_status] + for _, s in pairs(git_status) do + local icons = M.git_icons[s] if not icons then if not M.config.highlight_git then - warn_status(git_status) + warn_status(s) end return nil end From a61763f519cde11260b2cd775e8fe2a5275e0ac6 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Mon, 12 Dec 2022 23:56:15 +1300 Subject: [PATCH 13/16] explorer/common.lua -> explorer/node.lua --- lua/nvim-tree/actions/moves/item.lua | 4 ++-- lua/nvim-tree/actions/reloaders/reloaders.lua | 4 ++-- lua/nvim-tree/explorer/explore.lua | 8 ++++---- lua/nvim-tree/explorer/init.lua | 6 +++--- lua/nvim-tree/explorer/{common.lua => node.lua} | 0 lua/nvim-tree/explorer/reload.lua | 14 +++++++------- lua/nvim-tree/git/init.lua | 6 +++--- lua/nvim-tree/renderer/components/git.lua | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) rename lua/nvim-tree/explorer/{common.lua => node.lua} (100%) diff --git a/lua/nvim-tree/actions/moves/item.lua b/lua/nvim-tree/actions/moves/item.lua index 0bd064de0fe..556fd071720 100644 --- a/lua/nvim-tree/actions/moves/item.lua +++ b/lua/nvim-tree/actions/moves/item.lua @@ -2,7 +2,7 @@ local utils = require "nvim-tree.utils" local view = require "nvim-tree.view" local core = require "nvim-tree.core" local lib = require "nvim-tree.lib" -local explorer_common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local M = {} @@ -15,7 +15,7 @@ function M.fn(where, what) for line, node in pairs(nodes_by_line) do local valid = false if what == "git" then - valid = explorer_common.get_git_status(node) ~= nil + valid = explorer_node.get_git_status(node) ~= nil elseif what == "diag" then valid = node.diag_status ~= nil end diff --git a/lua/nvim-tree/actions/reloaders/reloaders.lua b/lua/nvim-tree/actions/reloaders/reloaders.lua index b8bf9057225..b6005ae87ad 100644 --- a/lua/nvim-tree/actions/reloaders/reloaders.lua +++ b/lua/nvim-tree/actions/reloaders/reloaders.lua @@ -3,7 +3,7 @@ local view = require "nvim-tree.view" local renderer = require "nvim-tree.renderer" local explorer_module = require "nvim-tree.explorer" local core = require "nvim-tree.core" -local explorer_common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local M = {} @@ -22,7 +22,7 @@ function M.reload_node_status(parent_node, projects) local project_root = git.get_project_root(parent_node.absolute_path) local status = projects[project_root] or {} for _, node in ipairs(parent_node.nodes) do - explorer_common.update_git_status(node, explorer_common.is_git_ignored(parent_node), status) + explorer_node.update_git_status(node, explorer_node.is_git_ignored(parent_node), status) if node.nodes and #node.nodes > 0 then M.reload_node_status(node, projects) end diff --git a/lua/nvim-tree/explorer/explore.lua b/lua/nvim-tree/explorer/explore.lua index 81c6713d5f9..7a83980ea05 100644 --- a/lua/nvim-tree/explorer/explore.lua +++ b/lua/nvim-tree/explorer/explore.lua @@ -1,6 +1,6 @@ local utils = require "nvim-tree.utils" local builders = require "nvim-tree.explorer.node-builders" -local common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local sorters = require "nvim-tree.explorer.sorters" local filters = require "nvim-tree.explorer.filters" local live_filter = require "nvim-tree.live-filter" @@ -13,7 +13,7 @@ local function get_type_from(type_, cwd) end local function populate_children(handle, cwd, node, git_status) - local node_ignored = common.is_git_ignored(node) + local node_ignored = explorer_node.is_git_ignored(node) local nodes_by_path = utils.bool_record(node.nodes, "absolute_path") local filter_status = filters.prepare(git_status) while true do @@ -39,7 +39,7 @@ local function populate_children(handle, cwd, node, git_status) if child then table.insert(node.nodes, child) nodes_by_path[child.absolute_path] = true - common.update_git_status(child, node_ignored, git_status) + explorer_node.update_git_status(child, node_ignored, git_status) end end end @@ -64,7 +64,7 @@ function M.explore(node, status) populate_children(handle, cwd, node, status) local is_root = not node.parent - local child_folder_only = common.has_one_child_folder(node) and node.nodes[1] + local child_folder_only = explorer_node.has_one_child_folder(node) and node.nodes[1] if M.config.group_empty and not is_root and child_folder_only then node.group_next = child_folder_only local ns = M.explore(child_folder_only, status) diff --git a/lua/nvim-tree/explorer/init.lua b/lua/nvim-tree/explorer/init.lua index 437ba94ff58..a47ac4d7423 100644 --- a/lua/nvim-tree/explorer/init.lua +++ b/lua/nvim-tree/explorer/init.lua @@ -1,6 +1,6 @@ local git = require "nvim-tree.git" local watch = require "nvim-tree.explorer.watch" -local common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local M = {} @@ -34,7 +34,7 @@ end function Explorer:destroy() local function iterate(node) - common.node_destroy(node) + explorer_node.node_destroy(node) if node.nodes then for _, child in pairs(node.nodes) do iterate(child) @@ -45,7 +45,7 @@ function Explorer:destroy() end function M.setup(opts) - require("nvim-tree.explorer.common").setup(opts) + require("nvim-tree.explorer.node").setup(opts) require("nvim-tree.explorer.explore").setup(opts) require("nvim-tree.explorer.filters").setup(opts) require("nvim-tree.explorer.sorters").setup(opts) diff --git a/lua/nvim-tree/explorer/common.lua b/lua/nvim-tree/explorer/node.lua similarity index 100% rename from lua/nvim-tree/explorer/common.lua rename to lua/nvim-tree/explorer/node.lua diff --git a/lua/nvim-tree/explorer/reload.lua b/lua/nvim-tree/explorer/reload.lua index 3d3dda5d8f8..da727925466 100644 --- a/lua/nvim-tree/explorer/reload.lua +++ b/lua/nvim-tree/explorer/reload.lua @@ -1,6 +1,6 @@ local utils = require "nvim-tree.utils" local builders = require "nvim-tree.explorer.node-builders" -local common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local filters = require "nvim-tree.explorer.filters" local sorters = require "nvim-tree.explorer.sorters" local live_filter = require "nvim-tree.live-filter" @@ -15,7 +15,7 @@ local M = {} local function update_status(nodes_by_path, node_ignored, status) return function(node) if nodes_by_path[node.absolute_path] then - common.update_git_status(node, node_ignored, status) + explorer_node.update_git_status(node, node_ignored, status) end return node end @@ -29,7 +29,7 @@ end local function update_parent_statuses(node, project, root) while project and node and node.absolute_path ~= root do - common.update_git_status(node, false, project) + explorer_node.update_git_status(node, false, project) node = node.parent end end @@ -53,7 +53,7 @@ function M.reload(node, git_status, unloaded_bufnr) local child_names = {} - local node_ignored = common.is_git_ignored(node) + local node_ignored = explorer_node.is_git_ignored(node) local nodes_by_path = utils.key_by(node.nodes, "absolute_path") while true do local ok, name, t = pcall(vim.loop.fs_scandir_next, handle) @@ -82,7 +82,7 @@ function M.reload(node, git_status, unloaded_bufnr) if n.type ~= t then utils.array_remove(node.nodes, n) - common.node_destroy(n) + explorer_node.node_destroy(n) nodes_by_path[abs] = nil end end @@ -119,14 +119,14 @@ function M.reload(node, git_status, unloaded_bufnr) if child_names[n.absolute_path] then return child_names[n.absolute_path] else - common.node_destroy(n) + explorer_node.node_destroy(n) return nil end end, node.nodes) ) local is_root = not node.parent - local child_folder_only = common.has_one_child_folder(node) and node.nodes[1] + local child_folder_only = explorer_node.has_one_child_folder(node) and node.nodes[1] if M.config.group_empty and not is_root and child_folder_only then node.group_next = child_folder_only local ns = M.reload(child_folder_only, git_status) diff --git a/lua/nvim-tree/git/init.lua b/lua/nvim-tree/git/init.lua index 35c680b9cb8..308838750e7 100644 --- a/lua/nvim-tree/git/init.lua +++ b/lua/nvim-tree/git/init.lua @@ -4,7 +4,7 @@ local git_utils = require "nvim-tree.git.utils" local Runner = require "nvim-tree.git.runner" local Watcher = require("nvim-tree.watcher").Watcher local Iterator = require "nvim-tree.iterators.node-iterator" -local explorer_common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local M = { config = {}, @@ -109,8 +109,8 @@ local function reload_tree_at(project_root) Iterator.builder(root_node.nodes) :hidden() :applier(function(node) - local parent_ignored = explorer_common.is_git_ignored(node.parent) - explorer_common.update_git_status(node, parent_ignored, git_status) + local parent_ignored = explorer_node.is_git_ignored(node.parent) + explorer_node.update_git_status(node, parent_ignored, git_status) end) :recursor(function(node) return node.nodes and #node.nodes > 0 and node.nodes diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index f6da7eb1dc6..1c51eb1d3ea 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -1,5 +1,5 @@ local notify = require "nvim-tree.notify" -local explorer_common = require "nvim-tree.explorer.common" +local explorer_node = require "nvim-tree.explorer.node" local M = { SIGN_GROUP = "NvimTreeGitSigns", @@ -60,7 +60,7 @@ local function warn_status(git_status) end local function get_icons_(node) - local git_status = explorer_common.get_git_status(node) + local git_status = explorer_node.get_git_status(node) if git_status == nil then return nil end @@ -132,7 +132,7 @@ function M.setup_signs(i) end local function get_highlight_(node) - local git_status = explorer_common.get_git_status(node) + local git_status = explorer_node.get_git_status(node) if git_status == nil then return end From c4b93dbae9f1f94d5fc837aa80d8205deac4201a Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 13 Dec 2022 14:06:04 +1300 Subject: [PATCH 14/16] fixed #1784 conflict --- lua/nvim-tree/explorer/filters.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/explorer/filters.lua b/lua/nvim-tree/explorer/filters.lua index c5701deaacd..8af47e1fe16 100644 --- a/lua/nvim-tree/explorer/filters.lua +++ b/lua/nvim-tree/explorer/filters.lua @@ -24,7 +24,9 @@ local function git(path, git_status) end -- default status to clean - local status = git_status.files[path] or git_status.dirs[path] or " " + local status = git_status.files[path] + status = status or git_status.dirs.direct[path] and git_status.dirs.direct[path][1] + status = status or git_status.dirs.indirect[path] and git_status.dirs.indirect[path][1] -- filter ignored; overrides clean as they are effectively dirty if M.config.filter_git_ignored and status == "!!" then @@ -32,7 +34,7 @@ local function git(path, git_status) end -- filter clean - if M.config.filter_git_clean and status == " " then + if M.config.filter_git_clean and not status then return true end From 23f6276ef76ccb12e8c9e02550d33525c469154a Mon Sep 17 00:00:00 2001 From: chomosuke Date: Tue, 13 Dec 2022 14:07:05 +1300 Subject: [PATCH 15/16] don't order icons --- lua/nvim-tree/renderer/builder.lua | 15 ++++----------- lua/nvim-tree/renderer/components/git.lua | 14 +++++++------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/lua/nvim-tree/renderer/builder.lua b/lua/nvim-tree/renderer/builder.lua index 52657bab810..99ec94313ca 100644 --- a/lua/nvim-tree/renderer/builder.lua +++ b/lua/nvim-tree/renderer/builder.lua @@ -248,17 +248,10 @@ function Builder:_build_line(node, idx, num_children) local git_highlight = git.get_highlight(node) local git_icons_tbl = git.get_icons(node) - if git_icons_tbl and #git_icons_tbl > 0 then - if self.is_git_sign then - local git_info = git_icons_tbl[1] - table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) - git_icons_tbl = {} - else - -- sort icons so it looks slightly better - table.sort(git_icons_tbl, function(a, b) - return a.ord < b.ord - end) - end + if git_icons_tbl and #git_icons_tbl > 0 and self.is_git_sign then + local git_info = git_icons_tbl[1] + table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) + git_icons_tbl = {} end local is_folder = node.nodes ~= nil diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 1c51eb1d3ea..5d0873be04a 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -7,13 +7,13 @@ local M = { local function build_icons_table(i) local icons = { - staged = { icon = i.staged, hl = "NvimTreeGitStaged", ord = 1 }, - unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty", ord = 2 }, - renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed", ord = 3 }, - deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted", ord = 4 }, - unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge", ord = 5 }, - untracked = { icon = i.untracked, hl = "NvimTreeGitNew", ord = 6 }, - ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored", ord = 7 }, + staged = { icon = i.staged, hl = "NvimTreeGitStaged" }, + unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" }, + renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" }, + deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" }, + unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" }, + untracked = { icon = i.untracked, hl = "NvimTreeGitNew" }, + ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" }, } return { ["M "] = { icons.staged }, From d5faa8f6d6c77ed26098c016aa253c9e1bad0812 Mon Sep 17 00:00:00 2001 From: chomosuke Date: Fri, 16 Dec 2022 23:41:26 +1300 Subject: [PATCH 16/16] Revert "don't order icons" This reverts commit 23f6276ef76ccb12e8c9e02550d33525c469154a. --- lua/nvim-tree/renderer/builder.lua | 15 +++++++++++---- lua/nvim-tree/renderer/components/git.lua | 14 +++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lua/nvim-tree/renderer/builder.lua b/lua/nvim-tree/renderer/builder.lua index 99ec94313ca..52657bab810 100644 --- a/lua/nvim-tree/renderer/builder.lua +++ b/lua/nvim-tree/renderer/builder.lua @@ -248,10 +248,17 @@ function Builder:_build_line(node, idx, num_children) local git_highlight = git.get_highlight(node) local git_icons_tbl = git.get_icons(node) - if git_icons_tbl and #git_icons_tbl > 0 and self.is_git_sign then - local git_info = git_icons_tbl[1] - table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) - git_icons_tbl = {} + if git_icons_tbl and #git_icons_tbl > 0 then + if self.is_git_sign then + local git_info = git_icons_tbl[1] + table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) + git_icons_tbl = {} + else + -- sort icons so it looks slightly better + table.sort(git_icons_tbl, function(a, b) + return a.ord < b.ord + end) + end end local is_folder = node.nodes ~= nil diff --git a/lua/nvim-tree/renderer/components/git.lua b/lua/nvim-tree/renderer/components/git.lua index 5d0873be04a..1c51eb1d3ea 100644 --- a/lua/nvim-tree/renderer/components/git.lua +++ b/lua/nvim-tree/renderer/components/git.lua @@ -7,13 +7,13 @@ local M = { local function build_icons_table(i) local icons = { - staged = { icon = i.staged, hl = "NvimTreeGitStaged" }, - unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" }, - renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" }, - deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" }, - unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" }, - untracked = { icon = i.untracked, hl = "NvimTreeGitNew" }, - ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" }, + staged = { icon = i.staged, hl = "NvimTreeGitStaged", ord = 1 }, + unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty", ord = 2 }, + renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed", ord = 3 }, + deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted", ord = 4 }, + unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge", ord = 5 }, + untracked = { icon = i.untracked, hl = "NvimTreeGitNew", ord = 6 }, + ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored", ord = 7 }, } return { ["M "] = { icons.staged },