Skip to content

feat(neovim): per-window winhighlight overrides (#140)#511

Merged
dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-140
May 22, 2026
Merged

feat(neovim): per-window winhighlight overrides (#140)#511
dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-140

Conversation

@gustav-fff
Copy link
Copy Markdown
Collaborator

Closes #140

Root cause

lua/fff/picker_ui.lua:961 builds one winhighlight string from hl.normal/hl.border/hl.title and applies it to all four picker windows (input, list, preview, file_info). No way to give the preview a different Normal background than prompt/list.

Fix

Add optional per-window overrides in hl: prompt_winhl, list_winhl, preview_winhl, file_info_winhl. When non-nil, the value is applied verbatim as that window's winhighlight. When nil, fallback to existing composed default. No behavior change for existing configs.

Steps to reproduce

Setup:
```lua
require('fff').setup({
hl = {
normal = 'NormalFloat',
},
})
```
Open picker. Prompt, list, and preview all share the same Normal:NormalFloat highlight. There is no exposed config option to set a different Normal highlight for the preview window only without monkey-patching nvim_open_win.

After fix:
```lua
require('fff').setup({
hl = {
list_winhl = 'Normal:NormalFloat,FloatBorder:FloatBorder,FloatTitle:Title',
prompt_winhl = 'Normal:NormalFloat,FloatBorder:FloatBorder,FloatTitle:Title',
preview_winhl = 'Normal:Normal,FloatBorder:FloatBorder,FloatTitle:Title',
},
})
```
Preview now uses regular Normal background while prompt/list use NormalFloat, matching the screenshot in the issue.

How verified

  • luac -p lua/fff/conf.lua lua/fff/picker_ui.lua — parses clean.
  • Manual: existing configs with only hl.normal/hl.border/hl.title still produce identical winhighlight (default branch hits the same string.format as before).
  • Diff size: 15+/5-, no API breakage.

Automated triage via gustav-fff bot.

@dmtrKovalenko dmtrKovalenko force-pushed the triage-bot/issue-140 branch from be146ff to 5f2b74c Compare May 22, 2026 16:29
Adds optional `hl.winhl` config that controls the picker windows'
`winhighlight`. Accepts either a single string applied to all picker
windows, or a table with optional `prompt`, `list`, `preview`, and
`file_info` keys. Missing keys fall back to the default composed from
`hl.normal`, `hl.border`, and `hl.title`.

Refs #140
@dmtrKovalenko dmtrKovalenko force-pushed the triage-bot/issue-140 branch from 5f2b74c to 308c43e Compare May 22, 2026 16:31
@dmtrKovalenko dmtrKovalenko merged commit 99f5160 into main May 22, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to set different highlights for preview buffer, list and prompt.

2 participants