Skip to content

Commit 23f6276

Browse files
committed
don't order icons
1 parent c4b93db commit 23f6276

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

lua/nvim-tree/renderer/builder.lua

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,10 @@ function Builder:_build_line(node, idx, num_children)
248248
local git_highlight = git.get_highlight(node)
249249
local git_icons_tbl = git.get_icons(node)
250250

251-
if git_icons_tbl and #git_icons_tbl > 0 then
252-
if self.is_git_sign then
253-
local git_info = git_icons_tbl[1]
254-
table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 })
255-
git_icons_tbl = {}
256-
else
257-
-- sort icons so it looks slightly better
258-
table.sort(git_icons_tbl, function(a, b)
259-
return a.ord < b.ord
260-
end)
261-
end
251+
if git_icons_tbl and #git_icons_tbl > 0 and self.is_git_sign then
252+
local git_info = git_icons_tbl[1]
253+
table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 })
254+
git_icons_tbl = {}
262255
end
263256

264257
local is_folder = node.nodes ~= nil

lua/nvim-tree/renderer/components/git.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ local M = {
77

88
local function build_icons_table(i)
99
local icons = {
10-
staged = { icon = i.staged, hl = "NvimTreeGitStaged", ord = 1 },
11-
unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty", ord = 2 },
12-
renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed", ord = 3 },
13-
deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted", ord = 4 },
14-
unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge", ord = 5 },
15-
untracked = { icon = i.untracked, hl = "NvimTreeGitNew", ord = 6 },
16-
ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored", ord = 7 },
10+
staged = { icon = i.staged, hl = "NvimTreeGitStaged" },
11+
unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" },
12+
renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" },
13+
deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" },
14+
unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" },
15+
untracked = { icon = i.untracked, hl = "NvimTreeGitNew" },
16+
ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" },
1717
}
1818
return {
1919
["M "] = { icons.staged },

0 commit comments

Comments
 (0)