From ce64ae18dedc5d6eeb1d1c9c20d730bd2f75754a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 20 Feb 2026 20:23:56 -0500 Subject: [PATCH] feat: add OilFileIcon highlight group for fallback file icons Problem: when nvim-web-devicons returns no highlight for an unrecognized file extension, the icon gets nil for its highlight group. Directories have OilDirIcon as a targetable fallback, but files have nothing. Solution: define OilFileIcon (linked to nil, matching OilFile) and use it as the fallback in the devicons provider when get_icon returns a nil highlight. The mini.icons provider already returns highlights for all files so only the devicons path needs this. Resolves: stevearc/oil.nvim#690 --- lua/oil/init.lua | 5 +++++ lua/oil/util.lua | 1 + 2 files changed, 6 insertions(+) diff --git a/lua/oil/init.lua b/lua/oil/init.lua index 824672e..db454d8 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -863,6 +863,11 @@ M._get_highlights = function() link = "OilDir", desc = "Icon for directories", }, + { + name = "OilFileIcon", + link = nil, + desc = "Icon for files", + }, { name = "OilSocket", link = "Keyword", diff --git a/lua/oil/util.lua b/lua/oil/util.lua index dc3ac14..ac04328 100644 --- a/lua/oil/util.lua +++ b/lua/oil/util.lua @@ -956,6 +956,7 @@ M.get_icon_provider = function() end end local icon, hl = devicons.get_icon(name) + hl = hl or "OilFileIcon" icon = icon or (conf and conf.default_file or "") return icon, hl end