Skip to content

Commit a2ca828

Browse files
committed
perf(status): further improve performance of file_icon provider
1 parent 6d929e7 commit a2ca828

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/astroui/status/provider.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,10 @@ function M.file_icon(opts)
405405
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
406406
if not devicons_avail then return "" end
407407
local bufnr = self and self.bufnr or 0
408-
local filename = vim.api.nvim_buf_get_name(bufnr)
409-
local ft_icon, _ =
410-
devicons.get_icon(vim.fn.fnamemodify(filename, ":t"), vim.fn.fnamemodify(filename, ":e"), { default = false })
411-
if not ft_icon then ft_icon = devicons.get_icon_by_filetype(vim.bo[bufnr].filetype, { default = true }) end
408+
local ft_icon, _ = devicons.get_icon(vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":t"))
409+
if not ft_icon then
410+
ft_icon, _ = devicons.get_icon_by_filetype(vim.bo[bufnr].filetype, { default = true })
411+
end
412412
return status_utils.stylize(ft_icon, opts)
413413
end
414414
end

0 commit comments

Comments
 (0)