1

Neovim: Add incline render function

This commit is contained in:
2024-06-04 23:51:47 +02:00
parent bf8661762c
commit bcb457b8b9

View File

@ -0,0 +1,25 @@
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 modified = vim.bo[props.buf].modified
local res = {
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
" ",
{ filename, gui = modified and "bold,italic" or "bold" },
guibg = "#44406e",
}
if props.focused then
for _, item in ipairs(navic.get_data(props.buf) or {}) do
table.insert(res, {
{ " > ", group = "NavicSeparator" },
{ item.icon, group = "NavicIcons" .. item.type },
{ item.name, group = "NavicText" },
})
end
end
table.insert(res, " ")
return res
end