telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Add grouping by file to "live_grep" picker

Open andyrichardson opened this issue 2 years ago • 4 comments

Hi there, huge thanks for all your work on this project!

Is your feature request related to a problem? Please describe.

I'd love to see grouping of results when using live_grep. This would come with a few advantages

  • remove noise of repeating file names
  • make it easier to distinguish files "at a glance"
  • create more horizontal space for grep results
Example in VS Code Screenshot 2023-01-01 at 22 04 20

Describe the solution you'd like

An option to display results, grouped by file.

When enabled: For each file containing a match, a heading is displayed. The heading cannot be selected/highlighted and only functions as an annotation. For each result, the position of the match, along with the highlighted matched string is shown.

Before

Screenshot 2023-01-01 at 21 59 43

After

Screenshot 2023-01-01 at 22 00 04

andyrichardson avatar Jan 01 '23 22:01 andyrichardson

I think this would be a great enhancement for "live_grep" and "grep_string".

That style of grouping results is also used to great effect, for example, by the vertico emacs package:

image

ivanbrennan avatar Feb 08 '23 03:02 ivanbrennan

would be so awesome

otavioschwanck avatar Oct 01 '23 00:10 otavioschwanck

I think this extension has something like it https://github.com/fdschmidt93/telescope-egrepify.nvim

I also think it'd be easier to make a new picker than to augment live_grep like it's been done with egrepify and live-grep-args. But I don't think there's any interest between the maintainers to add more builtin pickers.

jamestrew avatar Oct 01 '23 01:10 jamestrew

I think this extension has something like it https://github.com/fdschmidt93/telescope-egrepify.nvim

I also think it'd be easier to make a new picker than to augment live_grep like it's been done with egrepify and live-grep-args. But I don't think there's any interest between the maintainers to add more builtin pickers.

tested this extension, its like that, but i think this extension is still buggy

EDIT:

egrepify fixed all bugs that i pointed and now its super awesome, should be telescope default (+1 for egrepify)

otavioschwanck avatar Oct 01 '23 21:10 otavioschwanck