mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
refactor(incline.lua): remove unused functions get_git_diff and get_diagnostic_label
feat(incline.lua): add display of relative path in the rendered output for better context
This commit is contained in:
@@ -3,57 +3,60 @@ local helpers = require("incline.helpers")
|
|||||||
local devicons = require("nvim-web-devicons")
|
local devicons = require("nvim-web-devicons")
|
||||||
|
|
||||||
incline.setup({
|
incline.setup({
|
||||||
window = {
|
window = {
|
||||||
padding = 0,
|
padding = 0,
|
||||||
margin = { horizontal = 0 },
|
margin = { horizontal = 0 },
|
||||||
},
|
},
|
||||||
render = function(props)
|
render = function(props)
|
||||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||||
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
local filepath = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":p")
|
||||||
local modified = vim.bo[props.buf].modified
|
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
||||||
|
local modified = vim.bo[props.buf].modified
|
||||||
|
|
||||||
local function get_git_diff()
|
local path = vim.fn.fnamemodify(filepath, ":~:.") -- Get relative path
|
||||||
local icons = { removed = "", changed = "", added = "" }
|
|
||||||
local signs = vim.b[props.buf].gitsigns_status_dict
|
|
||||||
local labels = {}
|
|
||||||
if signs == nil then
|
|
||||||
return labels
|
|
||||||
end
|
|
||||||
for name, icon in pairs(icons) do
|
|
||||||
if tonumber(signs[name]) and signs[name] > 0 then
|
|
||||||
table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #labels > 0 then
|
|
||||||
table.insert(labels, { "┊ " })
|
|
||||||
end
|
|
||||||
return labels
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_diagnostic_label()
|
-- local function get_git_diff()
|
||||||
local icons = { error = "", warn = "", info = "", hint = "" }
|
-- local icons = { removed = "", changed = "", added = "" }
|
||||||
local label = {}
|
-- local signs = vim.b[props.buf].gitsigns_status_dict
|
||||||
|
-- local labels = {}
|
||||||
for severity, icon in pairs(icons) do
|
-- if signs == nil then
|
||||||
local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
|
-- return labels
|
||||||
if n > 0 then
|
-- end
|
||||||
table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity })
|
-- for name, icon in pairs(icons) do
|
||||||
end
|
-- if tonumber(signs[name]) and signs[name] > 0 then
|
||||||
end
|
-- table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name })
|
||||||
if #label > 0 then
|
-- end
|
||||||
table.insert(label, { "┊ " })
|
-- end
|
||||||
end
|
-- if #labels > 0 then
|
||||||
return label
|
-- table.insert(labels, { "┊ " })
|
||||||
end
|
-- end
|
||||||
|
-- return labels
|
||||||
return {
|
-- end
|
||||||
{ get_diagnostic_label() },
|
--
|
||||||
{ get_git_diff() },
|
-- local function get_diagnostic_label()
|
||||||
ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '',
|
-- local icons = { error = "", warn = "", info = "", hint = "" }
|
||||||
' ',
|
-- local label = {}
|
||||||
{ filename, gui = modified and 'bold,italic' or 'bold' },
|
--
|
||||||
' ',
|
-- for severity, icon in pairs(icons) do
|
||||||
guibg = '#44406e',
|
-- local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
|
||||||
}
|
-- if n > 0 then
|
||||||
end,
|
-- table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity })
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- if #label > 0 then
|
||||||
|
-- table.insert(label, { "┊ " })
|
||||||
|
-- end
|
||||||
|
-- return label
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
return {
|
||||||
|
-- { get_diagnostic_label() },
|
||||||
|
-- { get_git_diff() },
|
||||||
|
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
|
||||||
|
" ",
|
||||||
|
{ path, gui = modified and "bold,italic" or "bold" },
|
||||||
|
" ",
|
||||||
|
guibg = "#44406e",
|
||||||
|
}
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user