Context-aware visual dimming for Neovim. Dimit currently provides inactive-window dimming and search contrast, while keeping syntax colors recognizable rather than flattening them into a generic gray.
require('dimit').setup({
inactive = {
dim_factor = 0.65,
keep_same_file = true,
except = {
filetypes = { 'TelescopePrompt' },
buftypes = { 'prompt', 'quickfix', 'terminal' },
predicate = function(winid, bufnr)
return vim.w[winid].dimit_disable_all == true
end,
},
preserve_origin = {
filetypes = { 'TelescopePrompt' },
buftypes = { 'prompt', 'quickfix', 'terminal' },
},
},
})require('dimit').setup({
search = {
enabled = true,
visibility = 'active', -- or 'commandline'
blend = 65,
keep_cursor_line = true, -- set false to dim it like other non-matches
},
})Search contrast uses stable ephemeral per-window decorations on non-matching visible lines, leaving Neovim's Search, IncSearch, and CurSearch highlights untouched.
It dims foregrounds only toward the current filetype palette's Normal background: syntax hue is retained and syntax/background highlights are not replaced or dimmed.
Both Treesitter captures and legacy Vim syntax groups are preserved.
The cursor line remains fully lit by default.
active follows @/, including /, ?, *, #, g*, and g#
commandline limits contrast to interactive search/substitute input.
Interactive :s patterns are recognized as well.
Dimit can also dim everything except ranges matched by Treesitter captures. Filters are discovered at runtime from the buffer language's available Treesitter query groups (textobjects, locals, highlights, folds, and indents by default), so there are no per-language Dimit defaults to maintain.
Then focus a discovered capture:
:DimitTextobject functionRun without an argument to open a bottom-docked filter picker. Items are sorted by total matched text width for the current buffer. Moving in the picker previews each filter without inactive-window dimming the source window; <Enter> applies the selected filter, while <Esc>/q cancels.
:DimitTextobjectClear it with :DimitTextobjectClear, :DimitNoHighlight, or normal-mode <Esc>.
:DimitEnable:DimitDisable:DimitToggle:DimitNoHighlight— clear Dimit contrast, run:nohlsearch, and reapply Yamicon palettes when available.:DimitTextobject {capture}— dim everything except ranges matching an available Treesitter capture.:DimitTextobjectClear— clear textobject contrast.
A window owns one highlight namespace. Yamicon can preserve its per-window palette for Dimit by setting:
vim.api.nvim_win_set_var(winid, 'dimit_base_highlight_namespace', namespace)Dimit captures the leaving window's palette before focus changes, then derives that window's inactive namespace from it.
This prevents a filetype palette from being mixed with the newly focused window's or global colorscheme.
For windows without this variable, Dimit derives from global highlights.
Dimit will use independent window, line, and syntax renderers under a shared rule vocabulary.
except excludes the matching candidate window from inactive dimming; preserve_origin keeps the previously focused window undimmed while a matching transient utility buffer has focus.
Exceptions are scoped to the rule/layer; an explicit hard opt-out will be added as the broader rule model lands.