From 747e7b62224af2dbdfc4152f008bd32badecff18 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 23 Feb 2026 17:19:30 -0500 Subject: [PATCH] fix: make fname resolution more robust; --- lua/nonicons/override.lua | 4 ++-- lua/nonicons/resolve.lua | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lua/nonicons/override.lua b/lua/nonicons/override.lua index 7c0e8b5..64cccc1 100644 --- a/lua/nonicons/override.lua +++ b/lua/nonicons/override.lua @@ -107,7 +107,7 @@ function M.apply() local function override_tables() local by_ext = devicons.get_icons_by_extension() for ext, data in pairs(by_ext) do - local name = resolve_mod.ext_map[ext] + local name = resolve_mod.ext_map[ext] or resolve_mod.ext_map[ext:lower()] if name then data.icon = char(name) or fallback_icon else @@ -117,7 +117,7 @@ function M.apply() local by_filename = devicons.get_icons_by_filename() for fname, data in pairs(by_filename) do - local name = resolve_mod.filename_map[fname] + local name = resolve_mod.filename_map[fname] or resolve_mod.filename_map[fname:lower()] if name then data.icon = char(name) or fallback_icon else diff --git a/lua/nonicons/resolve.lua b/lua/nonicons/resolve.lua index 97f8738..42a881a 100644 --- a/lua/nonicons/resolve.lua +++ b/lua/nonicons/resolve.lua @@ -106,7 +106,7 @@ M.ext_map = { pm = 'perl', r = 'r', - R = 'r', + r = 'r', rmd = 'r', scala = 'scala', @@ -121,7 +121,7 @@ M.ext_map = { tf = 'terraform', tfvars = 'terraform', - Dockerfile = 'docker', + dockerfile = 'docker', dockerignore = 'docker', angular = 'angular', @@ -443,9 +443,18 @@ function M.resolve_name(name, ext) if M.filename_map[lower] then return M.filename_map[lower] end - local dot_ext = lower:match('%.(.+)$') - if dot_ext and M.ext_map[dot_ext] then - return M.ext_map[dot_ext] + local last_ext = lower:match('%.([^%.]+)$') + if last_ext and M.ext_map[last_ext] then + return M.ext_map[last_ext] + end + local compound = lower:match('%.(.+)$') + if compound and compound ~= last_ext then + while compound do + if M.ext_map[compound] then + return M.ext_map[compound] + end + compound = compound:match('%.(.+)$') + end end end end