From 8a34e8df76a98a65c149503366592aa11e9bee52 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Sat, 3 Sep 2022 23:22:48 +0300 Subject: [PATCH] neovim: recreate filename component for winbar --- neovim/.config/nvim/after/plugin/lualine.lua | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/neovim/.config/nvim/after/plugin/lualine.lua b/neovim/.config/nvim/after/plugin/lualine.lua index 7cd2094..200a195 100644 --- a/neovim/.config/nvim/after/plugin/lualine.lua +++ b/neovim/.config/nvim/after/plugin/lualine.lua @@ -36,6 +36,25 @@ local filetype = { 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 = { function() return "[" .. vim.bo.fileformat .. "]" @@ -93,10 +112,10 @@ lualine.setup({ lualine_a = { tabs }, }, winbar = { - lualine_a = { filetype }, + lualine_a = { filename }, }, inactive_winbar = { - lualine_a = { filetype }, + lualine_a = { filename }, }, sections = { lualine_a = { mode },