git icons|status: added support for 'typechange' diff

main
bhagwan 2 years ago
parent 5ae4148f77
commit 97d4ba31f7

@ -548,6 +548,7 @@ require'fzf-lua'.setup {
["A"] = { icon = "A", color = "green" },
["R"] = { icon = "R", color = "yellow" },
["C"] = { icon = "C", color = "yellow" },
["T"] = { icon = "T", color = "magenta" },
["?"] = { icon = "?", color = "magenta" },
-- override git icons?
-- ["M"] = { icon = "★", color = "red" },

@ -593,6 +593,7 @@ Consult the list below for available settings:
["A"] = { icon = "A", color = "green" },
["R"] = { icon = "R", color = "yellow" },
["C"] = { icon = "C", color = "yellow" },
["T"] = { icon = "T", color = "magenta" },
["?"] = { icon = "?", color = "magenta" },
-- override git icons?
-- ["M"] = { icon = "★", color = "red" },

@ -258,6 +258,7 @@ M.globals.git = {
["A"] = { icon = "A", color = "green" },
["R"] = { icon = "R", color = "yellow" },
["C"] = { icon = "C", color = "yellow" },
["T"] = { icon = "T", color = "magenta" },
["?"] = { icon = "?", color = "magenta" },
},
}

@ -195,7 +195,7 @@ M.get_diff_files = function(opts)
local ok, status, err = pcall(utils.io_systemlist, path.git_cwd(cmd, opts))
if ok and err == 0 then
for i = 1, #status do
local icon = status[i]:match("[MUDARC?]+")
local icon = status[i]:match("[MUDARCT?]+")
local file = status[i]:match("[^ ]*$")
if icon and file then
diff_files[file] = icon:gsub("%?%?", "?")

@ -247,7 +247,7 @@ function Previewer.git_diff:new(o, opts)
-- populate the icon mappings
local icons_overrides = o._fn_git_icons and o._fn_git_icons()
self.git_icons = {}
for _, i in ipairs({ "D", "M", "R", "A", "C", "?" }) do
for _, i in ipairs({ "D", "M", "R", "A", "C", "T", "?" }) do
self.git_icons[i] =
icons_overrides and icons_overrides[i] and
utils.lua_regex_escape(icons_overrides[i].icon) or i
@ -268,6 +268,7 @@ function Previewer.git_diff:cmdline(o)
self.git_icons['M'] ..
self.git_icons['R'] ..
self.git_icons['A'] ..
self.git_icons['T'] ..
"]" ..utils.nbsp) ~= nil
local is_untracked = items[1]:match("[" ..
self.git_icons['?'] ..

Loading…
Cancel
Save