File tree Expand file tree Collapse file tree 4 files changed +32
-24
lines changed Expand file tree Collapse file tree 4 files changed +32
-24
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ The variant is updated:
4545
4646However, be advised that the plugin using nvim-web-devicons may have cached the icons.
4747
48+ ### Case Sensitivity
49+
50+ Filename icons e.g. ` "Dockerfile" ` are case insensitively matched.
51+
52+ Extension icons e.g. ` "lua" ` are case sensitive.
53+
4854### Setup
4955
5056This adds all the highlight groups for the devicons
Original file line number Diff line number Diff line change @@ -353,6 +353,27 @@ local function get_highlight_ctermfg(icon_data)
353353 return nvim_get_hl_by_name (get_highlight_name (icon_data ), false ).foreground
354354end
355355
356+ --- Change all keys in a table to lowercase
357+ --- Remove entry when lowercase entry already exists
358+ --- @param t table
359+ local function lowercase_keys (t )
360+ if not t then
361+ return
362+ end
363+
364+ for k , v in pairs (t ) do
365+ if type (k ) == " string" then
366+ local lower_k = k :lower ()
367+ if lower_k ~= k then
368+ if not t [lower_k ] then
369+ t [lower_k ] = v
370+ end
371+ t [k ] = nil
372+ end
373+ end
374+ end
375+ end
376+
356377local loaded = false
357378
358379function M .has_loaded ()
@@ -396,6 +417,11 @@ function M.setup(opts)
396417 local user_desktop_environment_icons = user_icons .override_by_desktop_environment
397418 local user_window_manager_icons = user_icons .override_by_window_manager
398419
420+ -- filename matches are case insensitive
421+ lowercase_keys (icons_by_filename )
422+ lowercase_keys (user_icons .override )
423+ lowercase_keys (user_icons .override_by_filename )
424+
399425 icons = vim .tbl_extend (
400426 " force" ,
401427 icons ,
Original file line number Diff line number Diff line change @@ -275,12 +275,6 @@ local icons_by_filename = {
275275 cterm_color = " 28" ,
276276 name = " Vimrc" ,
277277 },
278- [" R" ] = {
279- icon = " " ,
280- color = " #2266ba" ,
281- cterm_color = " 25" ,
282- name = " R" ,
283- },
284278 [" avif" ] = {
285279 icon = " " ,
286280 color = " #a074c4" ,
@@ -833,12 +827,6 @@ local icons_by_filename = {
833827 cterm_color = " 77" ,
834828 name = " Qt" ,
835829 },
836- [" r" ] = {
837- icon = " " ,
838- color = " #2266ba" ,
839- cterm_color = " 25" ,
840- name = " R" ,
841- },
842830 [" rakefile" ] = {
843831 icon = " " ,
844832 color = " #701516" ,
Original file line number Diff line number Diff line change @@ -275,12 +275,6 @@ local icons_by_filename = {
275275 cterm_color = " 22" ,
276276 name = " Vimrc" ,
277277 },
278- [" R" ] = {
279- icon = " " ,
280- color = " #1a4c8c" ,
281- cterm_color = " 25" ,
282- name = " R" ,
283- },
284278 [" avif" ] = {
285279 icon = " " ,
286280 color = " #6b4d83" ,
@@ -833,12 +827,6 @@ local icons_by_filename = {
833827 cterm_color = " 28" ,
834828 name = " Qt" ,
835829 },
836- [" r" ] = {
837- icon = " " ,
838- color = " #1a4c8c" ,
839- cterm_color = " 25" ,
840- name = " R" ,
841- },
842830 [" rakefile" ] = {
843831 icon = " " ,
844832 color = " #701516" ,
You can’t perform that action at this time.
0 commit comments