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

Allow setting rg flags via an alternative search bar

Open mayromr opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Sometimes I want supply the -g flag to rg in order to filter out paths and file types, this can be done by creating a custom picker and splitting up the input based on a predetermined rule. Here are some examples that already do that: - https://www.youtube.com/watch?v=xdXE1tOT-qg - https://github.com/nvim-telescope/telescope-live-grep-args.nvim But both of those pickers face the same problem, they sometimes collide with the text you are trying find, which is very annoying.

Describe the solution you'd like Essentially I want to have a keybind that swaps the current search bar for a different search bar (kind of like how fuzzy_refine creates a different search bar, but keeps the value of both of them all the time) that sets the flag -g flag for rg, And then pressing that keybind again would swap back to the original search bar with the content it had before and keep the flags set by the alternative search bar.

I don't think hard coding this exact behavior just for the -g flag for live_grep is smart, I think that supplying an API that enables users to create a picker with a similar functionality would work grate for me use case and a lot of other use cases.

Describe alternatives you've considered I don't consider any alternatives but I am open for suggestions.

mayromr avatar Dec 21 '24 12:12 mayromr

I read into the docs and hacked something together, here is a link to my picker. I don't think it's of high quality (it's mostly copy pasted form live_grep) but someone might find this useful so I am leaving it here. I think that telescope should provide something like this out of the box so I am leaving this issue open for discussion.

mayromr avatar Dec 21 '24 19:12 mayromr

  • https://github.com/nvim-telescope/telescope-live-grep-args.nvim But both of those pickers face the same problem, they sometimes collide with the text you are trying find, which is very annoying.

Really? I haven't experienced this.

I think that telescope should provide something like this out of the box so I am leaving this issue open for discussion.

telescope-live-grep-args is basically supposed to be this so I'm very reluctant on expanding the existing live_grep functionality too much.

jamestrew avatar Feb 24 '25 17:02 jamestrew