don't order icons

This commit is contained in:
chomosuke
2022-12-13 14:07:05 +13:00
parent c4b93dbae9
commit 23f6276ef7
2 changed files with 11 additions and 18 deletions

View File

@@ -248,17 +248,10 @@ function Builder:_build_line(node, idx, num_children)
local git_highlight = git.get_highlight(node) local git_highlight = git.get_highlight(node)
local git_icons_tbl = git.get_icons(node) local git_icons_tbl = git.get_icons(node)
if git_icons_tbl and #git_icons_tbl > 0 then if git_icons_tbl and #git_icons_tbl > 0 and self.is_git_sign then
if self.is_git_sign then local git_info = git_icons_tbl[1]
local git_info = git_icons_tbl[1] table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 })
table.insert(self.signs, { sign = git_info.hl, lnum = self.index + 1 }) git_icons_tbl = {}
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 end
local is_folder = node.nodes ~= nil local is_folder = node.nodes ~= nil

View File

@@ -7,13 +7,13 @@ local M = {
local function build_icons_table(i) local function build_icons_table(i)
local icons = { local icons = {
staged = { icon = i.staged, hl = "NvimTreeGitStaged", ord = 1 }, staged = { icon = i.staged, hl = "NvimTreeGitStaged" },
unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty", ord = 2 }, unstaged = { icon = i.unstaged, hl = "NvimTreeGitDirty" },
renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed", ord = 3 }, renamed = { icon = i.renamed, hl = "NvimTreeGitRenamed" },
deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted", ord = 4 }, deleted = { icon = i.deleted, hl = "NvimTreeGitDeleted" },
unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge", ord = 5 }, unmerged = { icon = i.unmerged, hl = "NvimTreeGitMerge" },
untracked = { icon = i.untracked, hl = "NvimTreeGitNew", ord = 6 }, untracked = { icon = i.untracked, hl = "NvimTreeGitNew" },
ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored", ord = 7 }, ignored = { icon = i.ignored, hl = "NvimTreeGitIgnored" },
} }
return { return {
["M "] = { icons.staged }, ["M "] = { icons.staged },