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
This commit is contained in:
Barrett Ruth 2026-02-20 20:24:16 -05:00
parent f6bcdda988
commit 38db6cf8ea
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -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)
<!-- /TOC -->
@ -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
```