fix(nvim): use configurable grep_match hl in preview (#646) - #647
Merged
Merged
Conversation
The preview window hardcoded 'IncSearch' for grep match highlights while the results list uses config.hl.grep_match. Overriding grep_match had no effect on the preview, forcing users to override the global IncSearch group instead. Refs #646
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 #646
Root cause
lua/fff/location_utils.luahardcodedIncSearchfor grep match highlights in the preview window (lines 184, 228), while the results list usesconfig.hl.grep_match(lua/fff/picker_ui/grep_renderer.lua:232). Overridinghl.grep_matchin the user config styled the results list but not the preview, and overriding the globalIncSearchgroup did not propagate either (likely due to the preview'swinhighlightremappingNormaland treesitter groups painting over the extmark background in some colorschemes).Fix
Read
config.hl.grep_matchinhighlight_grep_matchesand use it for both the fuzzy and plain/regex code paths, falling back toIncSearchwhen unset. Preview and results now share the same configurable highlight group.Steps to reproduce
Setup:
Trigger:
Type any query.
Expected: matched substrings in the preview have the magenta background.
Actual (pre-fix): matches in the results list are magenta, matches in the preview window keep the theme's washed-out
IncSearch(or no background at all undergruvbox-material, per screenshots in the issue).How verified
Manual repro on macOS with the config above; after the fix the preview highlights honor the overridden
IncSearch, and settinghl.grep_match = 'Visual'in the fff config now restyles both list and preview consistently.Automated triage via Gustav. Honk-Honk 🪿