neovim: recreate filename component for winbar

This commit is contained in:
2022-09-03 23:22:48 +03:00
parent b7022b492e
commit 8a34e8df76

View File

@@ -36,6 +36,25 @@ local filetype = {
end, end,
} }
local filename = {
function()
local filetype = vim.bo.filetype
local filename = vim.fn.expand("%:t")
local fileext = vim.fn.expand("%:e")
local icon = devicons.get_icon(filename, fileext)
if filetype == "fugitive" then
icon = devicons.get_icons().git.icon
end
if not icon then
return filename
end
return icon .. " " .. filename
end,
}
local fileformat = { local fileformat = {
function() function()
return "[" .. vim.bo.fileformat .. "]" return "[" .. vim.bo.fileformat .. "]"
@@ -93,10 +112,10 @@ lualine.setup({
lualine_a = { tabs }, lualine_a = { tabs },
}, },
winbar = { winbar = {
lualine_a = { filetype }, lualine_a = { filename },
}, },
inactive_winbar = { inactive_winbar = {
lualine_a = { filetype }, lualine_a = { filename },
}, },
sections = { sections = {
lualine_a = { mode }, lualine_a = { mode },