Handle git deleted state.
This commit is contained in:
parent
505d63a3e7
commit
9cad30f1be
@ -40,6 +40,7 @@ local function get_hl_groups()
|
|||||||
ImageFile = { gui = 'bold', fg = colors.purple },
|
ImageFile = { gui = 'bold', fg = colors.purple },
|
||||||
|
|
||||||
GitDirty = { fg = colors.dark_red },
|
GitDirty = { fg = colors.dark_red },
|
||||||
|
GitDeleted = { fg = colors.dark_red },
|
||||||
GitStaged = { fg = colors.green },
|
GitStaged = { fg = colors.green },
|
||||||
GitMerge = { fg = colors.orange },
|
GitMerge = { fg = colors.orange },
|
||||||
GitRenamed = { fg = colors.purple },
|
GitRenamed = { fg = colors.purple },
|
||||||
@ -60,6 +61,7 @@ local function get_links()
|
|||||||
FileRenamed = 'LuaTreeGitRenamed',
|
FileRenamed = 'LuaTreeGitRenamed',
|
||||||
FileMerge = 'LuaTreeGitMerge',
|
FileMerge = 'LuaTreeGitMerge',
|
||||||
FileStaged = 'LuaTreeGitStaged',
|
FileStaged = 'LuaTreeGitStaged',
|
||||||
|
FileDeleted = 'LuaTreeGitDeleted',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,8 @@ function M.get_icon_state()
|
|||||||
staged = "✓",
|
staged = "✓",
|
||||||
unmerged = "",
|
unmerged = "",
|
||||||
renamed = "➜",
|
renamed = "➜",
|
||||||
untracked = "★"
|
untracked = "★",
|
||||||
|
deleted = ""
|
||||||
},
|
},
|
||||||
folder_icons = {
|
folder_icons = {
|
||||||
default = "",
|
default = "",
|
||||||
|
|||||||
@ -71,6 +71,7 @@ if vim.g.lua_tree_git_hl == 1 then
|
|||||||
["??"] = { { hl = "LuaTreeFileNew" } },
|
["??"] = { { hl = "LuaTreeFileNew" } },
|
||||||
["R "] = { { hl = "LuaTreeFileRenamed" } },
|
["R "] = { { hl = "LuaTreeFileRenamed" } },
|
||||||
["UU"] = { { hl = "LuaTreeFileMerge" } },
|
["UU"] = { { hl = "LuaTreeFileMerge" } },
|
||||||
|
[" D"] = { { hl = "LuaTreeFileDeleted" } },
|
||||||
dirty = { { hl = "LuaTreeFileDirty" } },
|
dirty = { { hl = "LuaTreeFileDirty" } },
|
||||||
}
|
}
|
||||||
get_git_hl = function(node)
|
get_git_hl = function(node)
|
||||||
@ -78,6 +79,11 @@ if vim.g.lua_tree_git_hl == 1 then
|
|||||||
if not git_status then return end
|
if not git_status then return end
|
||||||
|
|
||||||
local icons = git_hl[git_status]
|
local icons = git_hl[git_status]
|
||||||
|
|
||||||
|
if icons == nil then
|
||||||
|
icons = git_hl.dirty
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: how would we determine hl color when multiple git status are active ?
|
-- TODO: how would we determine hl color when multiple git status are active ?
|
||||||
return icons[1].hl
|
return icons[1].hl
|
||||||
-- return icons[#icons].hl
|
-- return icons[#icons].hl
|
||||||
@ -104,6 +110,7 @@ if icon_state.show_git_icon then
|
|||||||
["??"] = { { icon = icon_state.icons.git_icons.untracked, hl = "LuaTreeGitNew" } },
|
["??"] = { { icon = icon_state.icons.git_icons.untracked, hl = "LuaTreeGitNew" } },
|
||||||
["R "] = { { icon = icon_state.icons.git_icons.renamed, hl = "LuaTreeGitRenamed" } },
|
["R "] = { { icon = icon_state.icons.git_icons.renamed, hl = "LuaTreeGitRenamed" } },
|
||||||
["UU"] = { { icon = icon_state.icons.git_icons.unmerged, hl = "LuaTreeGitMerge" } },
|
["UU"] = { { icon = icon_state.icons.git_icons.unmerged, hl = "LuaTreeGitMerge" } },
|
||||||
|
[" D"] = { { icon = icon_state.icons.git_icons.deleted, hl = "LuaTreeGitDeleted" } },
|
||||||
dirty = { { icon = icon_state.icons.git_icons.unstaged, hl = "LuaTreeGitDirty" } },
|
dirty = { { icon = icon_state.icons.git_icons.unstaged, hl = "LuaTreeGitDirty" } },
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +119,7 @@ if icon_state.show_git_icon then
|
|||||||
if not git_status then return "" end
|
if not git_status then return "" end
|
||||||
|
|
||||||
local icon = ""
|
local icon = ""
|
||||||
local icons = git_icon_state[git_status]
|
local icons = git_icon_state[git_status] or git_icon_state.dirty
|
||||||
for _, v in ipairs(icons) do
|
for _, v in ipairs(icons) do
|
||||||
table.insert(hl, { v.hl, line, depth+icon_len+#icon, depth+icon_len+#icon+#v.icon })
|
table.insert(hl, { v.hl, line, depth+icon_len+#icon, depth+icon_len+#icon+#v.icon })
|
||||||
icon = icon..v.icon.." "
|
icon = icon..v.icon.." "
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user