From 56c9b087ea96a55ebd3fbc1da65bf89b18e3a086 Mon Sep 17 00:00:00 2001 From: siduck Date: Thu, 2 Jun 2022 23:58:08 +0530 Subject: [PATCH] fix edgecase for nonicon filetypes in statusline --- lua/plugins/configs/statusline.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/plugins/configs/statusline.lua b/lua/plugins/configs/statusline.lua index 818031a..d47aed0 100644 --- a/lua/plugins/configs/statusline.lua +++ b/lua/plugins/configs/statusline.lua @@ -252,14 +252,19 @@ options.file_info = { local filename = fn.expand "%:t" local extension = fn.expand "%:e" + if filename == "" then + return options.icons.empty_file + end + local icon = require("nvim-web-devicons").get_icon(filename, extension) - if icon == nil and fn.expand "%:t" == "" then - return options.icons.empty_file + if icon == nil then + icon = " " else - icon = icon .. " " or " " - return icon + icon = icon .. " " end + + return icon end, hl = "Feline_file_info",