Skip to content

Commit 77ed15f

Browse files
committed
perf(#3257): remove devicons setup
1 parent 6818250 commit 77ed15f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lua/nvim-tree/renderer/components/devicons.lua

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,11 @@ local initialized = false
1313

1414
local M = {}
1515

16-
---Attempt to use nvim-web-devicons if present and enabled for file or folder
17-
local function initialize()
18-
if config.g.renderer.icons.show.file or config.g.renderer.icons.show.folder then
19-
local ok, di = pcall(require, "nvim-web-devicons")
20-
if ok then
21-
devicons = di --[[@as DevIcons]]
22-
23-
-- does nothing if already called i.e. doesn't clobber previous user setup
24-
devicons.setup()
25-
end
26-
end
27-
initialized = true
28-
end
29-
3016
---Wrapper around nvim-web-devicons, nils if devicons not available
3117
---@type devicons_get_icon
3218
function M.get_icon(name, ext, opts)
3319
if not initialized then
34-
initialize()
20+
M.initialize()
3521
end
3622

3723
if devicons then
@@ -41,4 +27,18 @@ function M.get_icon(name, ext, opts)
4127
end
4228
end
4329

30+
---Attempt to use nvim-web-devicons if present and enabled for file or folder
31+
function M.initialize()
32+
if config.g.renderer.icons.show.file or config.g.renderer.icons.show.folder then
33+
local ok, di = pcall(require, "nvim-web-devicons")
34+
if ok then
35+
devicons = di --[[@as DevIcons]]
36+
37+
-- does nothing if already called i.e. doesn't clobber previous user setup
38+
devicons.setup()
39+
end
40+
end
41+
initialized = true
42+
end
43+
4444
return M

0 commit comments

Comments
 (0)