feat(neovim): per-window winhighlight overrides (#140)#511
Merged
Conversation
be146ff to
5f2b74c
Compare
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
5f2b74c to
308c43e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #140
Root cause
lua/fff/picker_ui.lua:961builds onewinhighlightstring fromhl.normal/hl.border/hl.titleand applies it to all four picker windows (input, list, preview, file_info). No way to give the preview a differentNormalbackground 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'swinhighlight. 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:NormalFloathighlight. There is no exposed config option to set a differentNormalhighlight for the preview window only without monkey-patchingnvim_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
Normalbackground while prompt/list useNormalFloat, matching the screenshot in the issue.How verified
luac -p lua/fff/conf.lua lua/fff/picker_ui.lua— parses clean.hl.normal/hl.border/hl.titlestill produce identicalwinhighlight(default branch hits the samestring.formatas before).Automated triage via gustav-fff bot.