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

add a sorter with highlighter to multi-ripgrep

Open etrobert opened this issue 10 months ago • 0 comments

Heya! 🤸🏼‍♂️

I really enjoyed your Advanced Telescope video, and have been playing along to add the "MultiGrep" to my setup.

I wanted to replace entirely my use of live_grep, but I noticed that the "MultiGrep" was missing highlighting of the match in the picker section.

live_grep uses require("telescope.sorters").highlighter_only(opts) as its sorter, and that did the trick, except when using a filename filtering pattern.

See: https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/__files.lua

So I copied the code from highlighter_only and adapted it to work with a split prompt.

See: https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/sorters.lua

Before: image After: image

I hope you find this useful, keep up the great work!

Étienne

Video: https://www.youtube.com/watch?v=xdXE1tOT-qg

etrobert avatar Apr 26 '25 12:04 etrobert