Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting rg flags via an alternative search bar #3390

Open
mayromr opened this issue Dec 21, 2024 · 2 comments
Open

Allow setting rg flags via an alternative search bar #3390

mayromr opened this issue Dec 21, 2024 · 2 comments
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@mayromr
Copy link

mayromr commented Dec 21, 2024

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 mayromr added the enhancement Enhancement to performance, inner workings or existent features label Dec 21, 2024
@mayromr
Copy link
Author

mayromr commented Dec 21, 2024

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.

@jamestrew
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

No branches or pull requests

2 participants