Skip to content

feat: add cursorlineopt config option for styling livegrep file preview#262

Merged
dmtrKovalenko merged 2 commits into
dmtrKovalenko:mainfrom
bansheerubber:cursorlineopt-config-for-livegrep
Feb 28, 2026
Merged

feat: add cursorlineopt config option for styling livegrep file preview#262
dmtrKovalenko merged 2 commits into
dmtrKovalenko:mainfrom
bansheerubber:cursorlineopt-config-for-livegrep

Conversation

@bansheerubber
Copy link
Copy Markdown
Contributor

@bansheerubber bansheerubber commented Feb 27, 2026

This is my first time contributing not only Lua code but also to a Neovim plugin, please let me know if changes are needed.

Summary
The live_grep file preview only highlights the current line number in the file preview instead of the entire line. I was having a tough time picking out which line matched my grep query in the file preview. I figured other people might like this feature too, so I decided to implement this as a config option that others can use.

I added the cursorlineopt property to the config.preview table since I figure it makes the most sense there (I can move it somewhere else if desired). The config option follows Neovim's cursorlineopt rules which can be found here. If cursorlineopt is not set, or if an invalid option is provided, then cursorlineopt defaults to both (as opposed to defaulting to whatever the global value of cursorlineopt is set to, which seems to be what fff.nvim currently does)

Before
image

After (using cursorlineopt = both)
image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new config.preview.cursorlineopt option to control how the cursorline is highlighted in the live_grep preview window, improving match readability in grep previews.

Changes:

  • Introduces preview.cursorlineopt configuration with default 'both'.
  • Applies the configured cursorlineopt to the preview window when in grep mode.
  • Documents the new option in README.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lua/fff/picker_ui.lua Sets cursorlineopt on the preview window in grep mode using resolved config value.
lua/fff/conf.lua Adds preview.cursorlineopt to config schema + default config.
README.md Documents the new preview.cursorlineopt option in the setup example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/fff/picker_ui.lua
Copy link
Copy Markdown
Owner

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has always highlighted the line for me and I can't see any difference with the code but it makes sense so I'll just merge it

@dmtrKovalenko dmtrKovalenko merged commit 29f81a1 into dmtrKovalenko:main Feb 28, 2026
29 of 31 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.

3 participants