Added incline plugin
This commit is contained in:
73
lua/taken/plugins/incline.lua
Normal file
73
lua/taken/plugins/incline.lua
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
return {
|
||||||
|
"b0o/incline.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
local incline = require("incline")
|
||||||
|
local devicons = require("nvim-web-devicons")
|
||||||
|
|
||||||
|
incline.setup({
|
||||||
|
highlight = {
|
||||||
|
groups = {
|
||||||
|
InclineNormal = {
|
||||||
|
default = true,
|
||||||
|
group = "Normal",
|
||||||
|
},
|
||||||
|
InclineNormalNC = {
|
||||||
|
default = true,
|
||||||
|
group = "Normal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
render = function(props)
|
||||||
|
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||||
|
if filename == "" then
|
||||||
|
filename = "[No Name]"
|
||||||
|
end
|
||||||
|
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
||||||
|
|
||||||
|
local function get_git_diff()
|
||||||
|
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 icons = { error = "", warn = "", info = "", hint = "" }
|
||||||
|
local label = {}
|
||||||
|
|
||||||
|
for severity, icon in pairs(icons) do
|
||||||
|
local n = #vim.diagnostic.get(
|
||||||
|
props.buf,
|
||||||
|
{ severity = vim.diagnostic.severity[string.upper(severity)] }
|
||||||
|
)
|
||||||
|
if n > 0 then
|
||||||
|
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() },
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -284,8 +284,10 @@ return {
|
|||||||
sections = {
|
sections = {
|
||||||
lualine_a = { mode },
|
lualine_a = { mode },
|
||||||
lualine_b = { filename, branch },
|
lualine_b = { filename, branch },
|
||||||
lualine_c = { diagnostics, sep, harpoon },
|
-- lualine_c = { diagnostics, sep, harpoon },
|
||||||
lualine_x = { copilot, diff, fileformat, lazy, mason },
|
lualine_c = { sep, harpoon },
|
||||||
|
-- lualine_x = { copilot, diff, fileformat, lazy, mason },
|
||||||
|
lualine_x = { copilot, fileformat, lazy, mason },
|
||||||
lualine_y = { buffers, filetype, progress },
|
lualine_y = { buffers, filetype, progress },
|
||||||
lualine_z = { location },
|
lualine_z = { location },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user