fff icon indicating copy to clipboard operation
fff copied to clipboard

[fff.nvim]: Show amount of results on grep results

Open DavidTelenko opened this issue 6 months ago • 5 comments

Is it possible to show amount of results instead or alongside of mode (<S-Tab> plain)?

╭ Grep ───────────────────────────────────────────────────────╮ Preview ─────────────────────────────────╮
│                                                             │  1 No preview available                  │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│    Start typing to search file contents...                  │                                          │
│                                                             │                                          │
│    Tips:                                                    │                                          │
│      "pattern *.rs"    search only in Rust files            │                                          │
│      "pattern /src/"   limit search to src/ directory       │                                          │
│      "!test pattern"   exclude test files                   │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
│                                                             │                                          │
├─────────────────────────────────────────────────────────────┤                                          │
│>                                 <S-Tab> plain │ results: 0 │                                          │
╰─────────────────────────────────────────────────────────────╯──────────────────────────────────────────╯

Somethings like this (results: 0).

Options can be implemented like this:

opts = {
  prompt = {
    vim_mode = true,
    title = '> ',
    results_format = '🪿 %s'
  }
}

@dmtrKovalenko I'm happy to open a PR. Want to hear your opinion on the idea.

DavidTelenko avatar May 18 '26 14:05 DavidTelenko

we do not expose the total results on the grep calls by design becuase we leverage pagination, that's why we never show (51/25787 matches) - this is just faster. I think what would be better if we can have a fallback similar to what we have with files matching but for fuzzy matching with some small page size e.g. 5

so you don't even need to switch to the mode

dmtrKovalenko avatar May 18 '26 17:05 dmtrKovalenko

So it will show the amount of results for current page, am I understanding you correctly? It might be a little bit misleading since sometimes, I just need to get the amount of things in repo (most often to understand what the scale of the refactor might be).

Also, thank you so much @dmtrKovalenko for such an amazing project! ❤️

DavidTelenko avatar May 18 '26 19:05 DavidTelenko

We do not not know how many matches are present, until the result return has_next_page: false

This is eternal design, so what we can do is to request some small page size e.g. 5 with a very limited time budget to show if there are matches at all

dmtrKovalenko avatar May 19 '26 01:05 dmtrKovalenko

[triage-bot] REPRODUCED: Grep mode status line currently shows mode indicator (<S-Tab> plain) but no result count. Feature request is valid - users want to see match count similar to file mode's matched/total display.

Root cause: update_status() in lua/fff/picker_ui.lua (lines 1962-2030) only shows mode indicator for grep, while file mode shows match counts.

Fix implemented: Modified grep status section to display both mode indicator and result count in format: <S-Tab> plain │ results: N. When only one mode configured, shows just results: N.

Testing: Verified pagination.total_matched is populated from grep search results and status line logic builds correct component text.

gustav-fff avatar May 20 '26 00:05 gustav-fff

closing this issue as it is out of scope rn, not finishing full search is something that allows fff to be 100 or 1000x faster than ripgrep in some cases so I'd like to keep this

dmtrKovalenko avatar Jun 17 '26 20:06 dmtrKovalenko