nvim: move incline to bottom right. add some styling

This commit is contained in:
Daniel Lundin 2024-03-29 10:24:47 +01:00
parent 8b1ee883d8
commit dba48cb52f

View file

@ -3,6 +3,17 @@ return {
config = function() config = function()
local devicons = require("nvim-web-devicons") local devicons = require("nvim-web-devicons")
require("incline").setup({ require("incline").setup({
window = {
margin = {
horizontal = 0,
vertical = 0,
},
padding = 0,
placement = {
horizontal = "right",
vertical = "bottom",
},
},
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")
if filename == "" then if filename == "" then
@ -11,7 +22,7 @@ return {
local ft_icon, ft_color = devicons.get_icon_color(filename) local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff() local function get_git_diff()
local icons = { removed = "", changed = "", added = "" } local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {} local labels = {}
if signs == nil then if signs == nil then
@ -23,13 +34,13 @@ return {
end end
end end
if #labels > 0 then if #labels > 0 then
table.insert(labels, { "" }) table.insert(labels, { " " })
end end
return labels return labels
end end
local function get_diagnostic_label() local function get_diagnostic_label()
local icons = { error = " ", warn = "󰀪 ", info = "", hint = "󰌶 " } local icons = { error = " ", warn = "󰀪 ", info = "", hint = " " }
local label = {} local label = {}
for severity, icon in pairs(icons) do for severity, icon in pairs(icons) do
@ -42,7 +53,7 @@ return {
end end
end end
if #label > 0 then if #label > 0 then
table.insert(label, { "", guifg = "#0d1117" }) table.insert(label, { " " })
end end
return label return label
end end
@ -50,11 +61,10 @@ return {
local bg_color = "#242e38" local bg_color = "#242e38"
return { return {
{ "", guibg = bg_color, guifg = "#0d1117" }, { "", guibg = "#0d1117", guifg = bg_color },
{ " ", guifg = "#0d1117", guibg = bg_color },
{ get_diagnostic_label(), guibg = bg_color }, { get_diagnostic_label(), guibg = bg_color },
{ " ", guibg = bg_color },
{ get_git_diff() }, { get_git_diff() },
-- { (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" },
{ filename .. " ", gui = "italic" }, { filename .. " ", gui = "italic" },
} }
end, end,