From 38db6cf8eae666058e6bfae67be55d781f88d78f Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 20 Feb 2026 20:24:16 -0500 Subject: [PATCH] docs(recipes): add recipe to disable hidden file dimming Problem: hidden files are dimmed via OilHidden -> Comment, and there is no clean way to make them look identical to visible entries. Clearing OilHidden alone causes all hidden types to lose their type-specific coloring. Solution: add a recipe that iterates _get_highlights() and relinks each Oil*Hidden group to its non-hidden base. The Lua pattern "^(Oil.+)Hidden$" naturally skips OilHidden itself and automatically covers any future entry types. Resolves: stevearc/oil.nvim#578 --- doc/recipes.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/recipes.md b/doc/recipes.md index aadb844..4fe8e33 100644 --- a/doc/recipes.md +++ b/doc/recipes.md @@ -9,6 +9,7 @@ Have a cool recipe to share? Open a pull request and add it to this doc! - [Hide gitignored files and show git tracked hidden files](#hide-gitignored-files-and-show-git-tracked-hidden-files) - [Open Telescope file finder in the current oil directory](#open-telescope-file-finder-in-the-current-oil-directory) - [Add custom column for file extension](#add-custom-column-for-file-extension) +- [Disable dimming of hidden files](#disable-dimming-of-hidden-files) @@ -244,3 +245,18 @@ require("oil").setup({ }, }) ``` + +## Disable dimming of hidden files + +By default, hidden files (toggled with `g.`) are dimmed via the `OilHidden` highlight group, which links to `Comment`. Every typed hidden group (`OilDirHidden`, `OilFileHidden`, etc.) links to `OilHidden`, so all hidden entries resolve to the same dim color regardless of their type. + +To make hidden files look identical to their visible counterparts, relink each hidden group to its non-hidden variant after calling `setup()`: + +```lua +for _, hl in ipairs(require("oil")._get_highlights()) do + local base = hl.name:match("^(Oil.+)Hidden$") + if base then + vim.api.nvim_set_hl(0, hl.name, { link = base }) + end +end +```