-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
Search refine like Ivy #793
Comments
it already have a PR #771 |
that PR only implements the layout, not the "refresh" |
simplescreenrecorder-2021-04-24_09.23.03.mp4I made a very rough proof of concept, someone needs to implement a better version |
@elianiva that looks pretty cool! Additionally to that, do you know how to do the ignore part? Regex maybe? |
I am not sure if this should be part of core. We can already do this with https://github.com/nvim-telescope/telescope-fzf-native.nvim just with space separated terms. Its also more powerful because it has suffix/prefix/exact/equal matching |
That's a ban from this repo! 😂 Yeah, the search refine would be cool. We can add this to 1.0 (might get pushed back depending on complexity) |
As a temporary workaround you can send all results into a quickfix list and then call |
I tried this but it's excruciatingly slow and doesn't seem to work right. So, I first did What works better for my purposes is to just use normal vim search ( |
@thomkeh I feel like we're talking about different things. In your description, I'd imagine that you do some search between Not sure about " |
@VVKot ah, sorry, the "it searches through the files instead of the entries" was just my theory to try to explain the slowness. Because with just 270 entries, it brought my whole nvim to a complete standstill such that I had to kill the nvim process. But what do you mean by "do some search between live_grep and ctrl-q"? Can I search on live_grep results somehow? |
@thomkeh understood, 270 is definitely something that nvim should easily handle! Please disregard that, I thought you were doing something like the below (which does not seem to be the case).
Re: search |
@elianiva do you have a branch I can have a look at? I'm trying to do something similar |
I havent had a look at this in a while, but it worked well back then |
@fdschmidt93 why is your implementation limited to fuzzy refining live grep? Can it be used to refine other searches? Will this feature request cover an scenario like this: |
Its not limited to those, but they are the ones for which it would make most sense.
If I understand it correctly, it is definitely possible, but you would have to write your own picker chain for this. Check out developers.md in the top level of the repo (am on mobile, cannot link). |
Thanks, I will have a look at that. I have been reading the code of live_grep and with the arguments it takes it seems not possible to limit the search to a list of files. It takes a list of folders, but that is not enough, I want to limit it to grep over a list of files. EDIT: I can probably build my own picker taking the live_grep as an example. Thanks for pointing it out. |
We now provide a somewhat basic interface to do that with implementations for It can also be used for other usecases, like find_files but we dont provide a implementation for that, you have to implement it yourself because i still think None the less you can still set it up for one or all pickers if you want to with the following snippet require("telescope").setup {
-- defaults = { },
pickers = {
find_files = {
mappings = {
i = {
["<c-space>"] = function(prompt_bufnr)
require("telescope.actions.generate").refine(prompt_bufnr, {
prompt_to_prefix = true,
sorter = false,
})
end,
},
},
},
},
-- extensions = { },
} This sets it up for |
Now you just need to add this to your telescope config: ts.setup {
pickers = {
live_grep = {
mappings = {
i = { ["<c-f>"] = actions.to_fuzzy_refine },
},
},
},
} And now you can refine the searches in |
Is your feature request related to a problem? Please describe.
It's not, unless there's already a way to do this with Telescope.
Describe the solution you'd like
I was trying a little bit of Emacs and I found Ivy, which has pretty cool features. One I found really interesting is that you can refine the search multiple times by accepting the current results and filtering those results again and again. The way you do this is by pressing
shift + space
.Describe alternatives you've considered
Tried with Fzf, which has a way to "ignore" results with
!
. This is not related to this feature request, but it should be great to know how to do this. Example:!.test
will show all the results that DON'T HAVE.test
extension.Additional context
Example from Emacs:
As you can see, each time the search expression disappears, is because it starts from zero with the filtered results.
Let me know what do you think, also about the question of Fzf "ignore".
The text was updated successfully, but these errors were encountered: