diff --git a/home/modules/neovim/inclineNavic.lua b/home/modules/neovim/inclineNavic.lua new file mode 100644 index 00000000..d923ec0c --- /dev/null +++ b/home/modules/neovim/inclineNavic.lua @@ -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