Skip to content

Commit ffd4834

Browse files
authored
refactor(icons): do not load web icons if not needed (#989)
We can set show_buffer_icons to false to disable web icons, but the icons is still being loaded during initialization. This is costly(loading the icon package needs ~ 20ms while the bufferlin package needs a few ms init time) and unnecessary when user doesn't need the icons anyways.
1 parent 9f0826a commit ffd4834

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lua/bufferline/utils/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ function M.get_icon(opts)
217217
if icon then return icon, hl end
218218
end
219219

220+
if not config.show_buffer_icons then
221+
return "", ""
222+
end
220223
local loaded, webdev_icons = pcall(require, "nvim-web-devicons")
221224
if opts.directory then
222225
local hl = loaded and "DevIconDefault" or nil

0 commit comments

Comments
 (0)