coding style
This commit is contained in:
@@ -22,20 +22,19 @@ function M.has_one_child_folder(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.update_git_status(node, parent_ignored, status)
|
function M.update_git_status(node, parent_ignored, status)
|
||||||
-- status of the node's absolute path
|
local get_status
|
||||||
if node.nodes then
|
if node.nodes then
|
||||||
node.git_status = get_dir_git_status(parent_ignored, status, node.absolute_path)
|
get_status = get_dir_git_status
|
||||||
else
|
else
|
||||||
node.git_status = get_git_status(parent_ignored, status, node.absolute_path)
|
get_status = get_git_status
|
||||||
end
|
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
|
-- status of the link target, if the link itself is not dirty
|
||||||
if node.link_to and not node.git_status then
|
if node.link_to and not node.git_status then
|
||||||
if node.nodes then
|
node.git_status = get_status(parent_ignored, status, node.link_to)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,63 +6,45 @@ local M = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function build_icons_table(i)
|
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 {
|
return {
|
||||||
["M "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
|
["M "] = { icons.staged },
|
||||||
[" M"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
|
[" M"] = { icons.unstaged },
|
||||||
["C "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
|
["C "] = { icons.staged },
|
||||||
[" C"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
|
[" C"] = { icons.unstaged },
|
||||||
["CM"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
|
["CM"] = { icons.unstaged },
|
||||||
[" T"] = { { icon = i.unstaged, hl = "NvimTreeGitDirty" } },
|
[" T"] = { icons.unstaged },
|
||||||
["T "] = { { icon = i.staged, hl = "NvimTreeGitStaged" } },
|
["T "] = { icons.staged },
|
||||||
["MM"] = {
|
["MM"] = { icons.staged, icons.unstaged },
|
||||||
{ icon = i.staged, hl = "NvimTreeGitStaged" },
|
["MD"] = { icons.staged },
|
||||||
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
|
["A "] = { icons.staged },
|
||||||
},
|
["AD"] = { icons.staged },
|
||||||
["MD"] = {
|
[" A"] = { icons.untracked },
|
||||||
{ icon = i.staged, hl = "NvimTreeGitStaged" },
|
|
||||||
},
|
|
||||||
["A "] = {
|
|
||||||
{ icon = i.staged, hl = "NvimTreeGitStaged" },
|
|
||||||
},
|
|
||||||
["AD"] = {
|
|
||||||
{ icon = i.staged, hl = "NvimTreeGitStaged" },
|
|
||||||
},
|
|
||||||
[" A"] = {
|
|
||||||
{ icon = i.untracked, hl = "NvimTreeGitNew" },
|
|
||||||
},
|
|
||||||
-- not sure about this one
|
-- not sure about this one
|
||||||
["AA"] = {
|
["AA"] = { icons.unmerged, icons.untracked },
|
||||||
{ icon = i.unmerged, hl = "NvimTreeGitMerge" },
|
["AU"] = { icons.unmerged, icons.untracked },
|
||||||
{ icon = i.untracked, hl = "NvimTreeGitNew" },
|
["AM"] = { icons.staged, icons.unstaged },
|
||||||
},
|
["??"] = { icons.untracked },
|
||||||
["AU"] = {
|
["R "] = { icons.renamed },
|
||||||
{ icon = i.unmerged, hl = "NvimTreeGitMerge" },
|
[" R"] = { icons.renamed },
|
||||||
{ icon = i.untracked, hl = "NvimTreeGitNew" },
|
["RM"] = { icons.unstaged, icons.renamed },
|
||||||
},
|
["UU"] = { icons.unmerged },
|
||||||
["AM"] = {
|
["UD"] = { icons.unmerged },
|
||||||
{ icon = i.staged, hl = "NvimTreeGitStaged" },
|
["UA"] = { icons.unmerged },
|
||||||
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
|
[" D"] = { icons.deleted },
|
||||||
},
|
["D "] = { icons.deleted },
|
||||||
["??"] = { { icon = i.untracked, hl = "NvimTreeGitNew" } },
|
["RD"] = { icons.deleted },
|
||||||
["R "] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
|
["DD"] = { icons.deleted },
|
||||||
[" R"] = { { icon = i.renamed, hl = "NvimTreeGitRenamed" } },
|
["DU"] = { icons.deleted, icons.unmerged },
|
||||||
["RM"] = {
|
["!!"] = { icons.ignored },
|
||||||
{ icon = i.unstaged, hl = "NvimTreeGitDirty" },
|
dirty = { icons.unstaged },
|
||||||
{ 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" } },
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user