fix: staged typechange in git

fixes #1066
fixes #885
This commit is contained in:
kiyan
2022-03-12 15:00:34 +01:00
parent a65078e3ae
commit d93a93c9c1

View File

@@ -4,62 +4,64 @@ local utils = require "nvim-tree.utils"
local M = {} local M = {}
local function build_icons_table() local function build_icons_table()
local i = M.icon_state.icons.git_icons
return { return {
["M "] = { { icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" } }, ["M "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
[" M"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } }, [" M"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
["C "] = { { icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" } }, ["C "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
[" C"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } }, [" C"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
["CM"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } }, ["CM"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
[" T"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } }, [" T"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
["T "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
["MM"] = { ["MM"] = {
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" }, { icon = i.staged, hl = "NvimTreeGitStaged" },
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" }, { icon = i.unstaged, hl = "NvimTreeGitDirty" },
}, },
["MD"] = { ["MD"] = {
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" }, { icon = i.staged, hl = "NvimTreeGitStaged" },
}, },
["A "] = { ["A "] = {
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" }, { icon = i.staged, hl = "NvimTreeGitStaged" },
}, },
["AD"] = { ["AD"] = {
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" }, { icon = i.staged, hl = "NvimTreeGitStaged" },
}, },
[" A"] = { [" A"] = {
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" }, { icon = i.untracked, hl = "NvimTreeGitNew" },
}, },
-- not sure about this one -- not sure about this one
["AA"] = { ["AA"] = {
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" }, { icon = i.unmerged, hl = "NvimTreeGitMerge" },
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" }, { icon = i.untracked, hl = "NvimTreeGitNew" },
}, },
["AU"] = { ["AU"] = {
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" }, { icon = i.unmerged, hl = "NvimTreeGitMerge" },
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" }, { icon = i.untracked, hl = "NvimTreeGitNew" },
}, },
["AM"] = { ["AM"] = {
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" }, { icon = i.staged, hl = "NvimTreeGitStaged" },
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" }, { icon = i.unstaged, hl = "NvimTreeGitDirty" },
}, },
["??"] = { { icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" } }, ["??"] = { { icon = i.untracked, hl = "NvimTreeGitNew" } },
["R "] = { { icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" } }, ["R "] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
[" R"] = { { icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" } }, [" R"] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
["RM"] = { ["RM"] = {
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" }, { icon = i.unstaged, hl = "NvimTreeGitDirty" },
{ icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" }, { icon = i.renamed, hl = "NvimTreeGitRenamed" },
}, },
["UU"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } }, ["UU"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
["UD"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } }, ["UD"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
["UA"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } }, ["UA"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
[" D"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } }, [" D"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
["D "] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } }, ["D "] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
["RD"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } }, ["RD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
["DD"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } }, ["DD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
["DU"] = { ["DU"] = {
{ icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" }, { icon = i.deleted, hl = "NvimTreeGitDeleted" },
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" }, { icon = i.unmerged, hl = "NvimTreeGitMerge" },
}, },
["!!"] = { { icon = M.icon_state.icons.git_icons.ignored, hl = "NvimTreeGitIgnored" } }, ["!!"] = { { icon = i.ignored, hl = "NvimTreeGitIgnored" } },
dirty = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } }, dirty = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
} }
end end
@@ -106,6 +108,7 @@ local git_hl = {
["AA"] = "NvimTreeFileStaged", ["AA"] = "NvimTreeFileStaged",
["AD"] = "NvimTreeFileStaged", ["AD"] = "NvimTreeFileStaged",
["MD"] = "NvimTreeFileStaged", ["MD"] = "NvimTreeFileStaged",
["T "] = "NvimTreeFileStaged",
[" M"] = "NvimTreeFileDirty", [" M"] = "NvimTreeFileDirty",
["CM"] = "NvimTreeFileDirty", ["CM"] = "NvimTreeFileDirty",
[" C"] = "NvimTreeFileDirty", [" C"] = "NvimTreeFileDirty",