Skip to content

Commit d93a93c

Browse files
committed
fix: staged typechange in git
fixes #1066 fixes #885
1 parent a65078e commit d93a93c

File tree

1 file changed

+37
-34
lines changed

1 file changed

+37
-34
lines changed

lua/nvim-tree/renderer/git.lua

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,64 @@ local utils = require "nvim-tree.utils"
44
local M = {}
55

66
local function build_icons_table()
7+
local i = M.icon_state.icons.git_icons
78
return {
8-
["M "] = { { icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" } },
9-
[" M"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } },
10-
["C "] = { { icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" } },
11-
[" C"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } },
12-
["CM"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } },
13-
[" T"] = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } },
9+
["M "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
10+
[" M"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
11+
["C "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
12+
[" C"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
13+
["CM"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
14+
[" T"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
15+
["T "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
1416
["MM"] = {
15-
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" },
16-
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" },
17+
{ icon = i.staged, hl = "NvimTreeGitStaged" },
18+
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
1719
},
1820
["MD"] = {
19-
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" },
21+
{ icon = i.staged, hl = "NvimTreeGitStaged" },
2022
},
2123
["A "] = {
22-
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" },
24+
{ icon = i.staged, hl = "NvimTreeGitStaged" },
2325
},
2426
["AD"] = {
25-
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" },
27+
{ icon = i.staged, hl = "NvimTreeGitStaged" },
2628
},
2729
[" A"] = {
28-
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" },
30+
{ icon = i.untracked, hl = "NvimTreeGitNew" },
2931
},
3032
-- not sure about this one
3133
["AA"] = {
32-
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" },
33-
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" },
34+
{ icon = i.unmerged, hl = "NvimTreeGitMerge" },
35+
{ icon = i.untracked, hl = "NvimTreeGitNew" },
3436
},
3537
["AU"] = {
36-
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" },
37-
{ icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" },
38+
{ icon = i.unmerged, hl = "NvimTreeGitMerge" },
39+
{ icon = i.untracked, hl = "NvimTreeGitNew" },
3840
},
3941
["AM"] = {
40-
{ icon = M.icon_state.icons.git_icons.staged, hl = "NvimTreeGitStaged" },
41-
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" },
42+
{ icon = i.staged, hl = "NvimTreeGitStaged" },
43+
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
4244
},
43-
["??"] = { { icon = M.icon_state.icons.git_icons.untracked, hl = "NvimTreeGitNew" } },
44-
["R "] = { { icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" } },
45-
[" R"] = { { icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" } },
45+
["??"] = { { icon = i.untracked, hl = "NvimTreeGitNew" } },
46+
["R "] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
47+
[" R"] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
4648
["RM"] = {
47-
{ icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" },
48-
{ icon = M.icon_state.icons.git_icons.renamed, hl = "NvimTreeGitRenamed" },
49+
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
50+
{ icon = i.renamed, hl = "NvimTreeGitRenamed" },
4951
},
50-
["UU"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } },
51-
["UD"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } },
52-
["UA"] = { { icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" } },
53-
[" D"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } },
54-
["D "] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } },
55-
["RD"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } },
56-
["DD"] = { { icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" } },
52+
["UU"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
53+
["UD"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
54+
["UA"] = { { icon = i.unmerged, hl = "NvimTreeGitMerge" } },
55+
[" D"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
56+
["D "] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
57+
["RD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
58+
["DD"] = { { icon = i.deleted, hl = "NvimTreeGitDeleted" } },
5759
["DU"] = {
58-
{ icon = M.icon_state.icons.git_icons.deleted, hl = "NvimTreeGitDeleted" },
59-
{ icon = M.icon_state.icons.git_icons.unmerged, hl = "NvimTreeGitMerge" },
60+
{ icon = i.deleted, hl = "NvimTreeGitDeleted" },
61+
{ icon = i.unmerged, hl = "NvimTreeGitMerge" },
6062
},
61-
["!!"] = { { icon = M.icon_state.icons.git_icons.ignored, hl = "NvimTreeGitIgnored" } },
62-
dirty = { { icon = M.icon_state.icons.git_icons.unstaged, hl = "NvimTreeGitDirty" } },
63+
["!!"] = { { icon = i.ignored, hl = "NvimTreeGitIgnored" } },
64+
dirty = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
6365
}
6466
end
6567

@@ -106,6 +108,7 @@ local git_hl = {
106108
["AA"] = "NvimTreeFileStaged",
107109
["AD"] = "NvimTreeFileStaged",
108110
["MD"] = "NvimTreeFileStaged",
111+
["T "] = "NvimTreeFileStaged",
109112
[" M"] = "NvimTreeFileDirty",
110113
["CM"] = "NvimTreeFileDirty",
111114
[" C"] = "NvimTreeFileDirty",

0 commit comments

Comments
 (0)