Skip to content

Commit 721db4b

Browse files
committed
feat: include DE & WM icons on "Hi" test
1 parent 1a54fdc commit 721db4b

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

lua/nvim-web-devicons.lua

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
local M = {}
22

3-
-- When adding new icons, remember to add an entry to the `filetypes` table, if applicable.
3+
-- NOTE: When adding new icons, remember to add an entry to the `filetypes` table, if applicable.
44
local icons, icons_by_filename, icons_by_file_extension, icons_by_operating_system
5+
local icons_by_desktop_environment, icons_by_window_manager
56

67
local default_icon = {
78
icon = "",
@@ -33,7 +34,17 @@ local function refresh_icons()
3334
icons_by_filename = theme.icons_by_filename
3435
icons_by_file_extension = theme.icons_by_file_extension
3536
icons_by_operating_system = theme.icons_by_operating_system
36-
icons = vim.tbl_extend("keep", {}, icons_by_filename, icons_by_file_extension, icons_by_operating_system)
37+
icons_by_desktop_environment = theme.icons_by_desktop_environment
38+
icons_by_window_manager = theme.icons_by_window_manager
39+
icons = vim.tbl_extend(
40+
"keep",
41+
{},
42+
icons_by_filename,
43+
icons_by_file_extension,
44+
icons_by_operating_system,
45+
icons_by_desktop_environment,
46+
icons_by_window_manager
47+
)
3748
icons = vim.tbl_extend("force", icons, global_opts.override)
3849
icons[1] = default_icon
3950
end
@@ -345,22 +356,28 @@ function M.setup(opts)
345356
local user_filename_icons = user_icons.override_by_filename
346357
local user_file_ext_icons = user_icons.override_by_extension
347358
local user_operating_system_icons = user_icons.override_by_operating_system
359+
local user_desktop_environment_icons = user_icons.override_by_desktop_environment
360+
local user_window_manager_icons = user_icons.override_by_window_manager
348361

349362
icons = vim.tbl_extend(
350363
"force",
351364
icons,
352365
user_icons.override or {},
353366
user_filename_icons or {},
354367
user_file_ext_icons or {},
355-
user_operating_system_icons or {}
368+
user_operating_system_icons or {},
369+
user_desktop_environment_icons or {},
370+
user_window_manager_icons or {}
356371
)
357372
global_opts.override = vim.tbl_extend(
358373
"force",
359374
global_opts.override,
360375
user_icons.override or {},
361376
user_filename_icons or {},
362377
user_file_ext_icons or {},
363-
user_operating_system_icons or {}
378+
user_operating_system_icons or {},
379+
user_desktop_environment_icons or {},
380+
user_window_manager_icons or {}
364381
)
365382

366383
if user_filename_icons then
@@ -372,6 +389,12 @@ function M.setup(opts)
372389
if user_operating_system_icons then
373390
icons_by_operating_system = vim.tbl_extend("force", icons_by_operating_system, user_operating_system_icons)
374391
end
392+
if user_desktop_environment_icons then
393+
icons_by_desktop_environment = vim.tbl_extend("force", icons_by_desktop_environment, user_desktop_environment_icons)
394+
end
395+
if user_window_manager_icons then
396+
icons_by_window_manager = vim.tbl_extend("force", icons_by_window_manager, user_window_manager_icons)
397+
end
375398

376399
icons[1] = default_icon
377400

@@ -390,7 +413,9 @@ function M.setup(opts)
390413
global_opts.override,
391414
icons_by_filename,
392415
icons_by_file_extension,
393-
icons_by_operating_system
416+
icons_by_operating_system,
417+
icons_by_desktop_environment,
418+
icons_by_window_manager
394419
)
395420
end, {
396421
desc = "nvim-web-devicons: highlight test",

lua/nvim-web-devicons/hi-test.lua

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,17 @@ end
104104
---@param icons_by_filename table[] filename "By File Name"
105105
---@param icons_by_file_extension table[] extension "By File Extension"
106106
---@param icons_by_operating_system table[] os "By Operating System"
107-
return function(default_icon, global_override, icons_by_filename, icons_by_file_extension, icons_by_operating_system)
107+
---@param icons_by_desktop_environment table[] os "By Desktop Environment"
108+
---@param icons_by_window_manager table[] os "By Window Manager"
109+
return function(
110+
default_icon,
111+
global_override,
112+
icons_by_filename,
113+
icons_by_file_extension,
114+
icons_by_operating_system,
115+
icons_by_desktop_environment,
116+
icons_by_window_manager
117+
)
108118
-- create a buffer
109119
local bufnr = vim.api.nvim_create_buf(false, true)
110120

@@ -116,7 +126,9 @@ return function(default_icon, global_override, icons_by_filename, icons_by_file_
116126
end
117127
l = render_icons(bufnr, l, icons_by_filename, "By File Name")
118128
l = render_icons(bufnr, l, icons_by_file_extension, "By File Extension")
119-
render_icons(bufnr, l, icons_by_operating_system, "By Operating System")
129+
l = render_icons(bufnr, l, icons_by_operating_system, "By Operating System")
130+
l = render_icons(bufnr, l, icons_by_desktop_environment, "By Desktop Environment")
131+
render_icons(bufnr, l, icons_by_window_manager, "By Window Manager")
120132

121133
-- finalise and focus the buffer
122134
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)

0 commit comments

Comments
 (0)