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

Buffer search #5597

Open
haikyuu opened this issue Jan 19, 2023 · 6 comments
Open

Buffer search #5597

haikyuu opened this issue Jan 19, 2023 · 6 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@haikyuu
Copy link

haikyuu commented Jan 19, 2023

We currently have / for global search in workspace folder. But searching open buffers is sometimes useful. Maybe map it to [ (for open) to keep close to /.

@haikyuu haikyuu added the C-enhancement Category: Improvements label Jan 19, 2023
@kirawi kirawi added E-easy Call for participation: Experience needed to fix: Easy / not much A-helix-term Area: Helix term improvements E-good-first-issue Call for participation: Issues suitable for new contributors labels Jan 20, 2023
@ontley
Copy link
Contributor

ontley commented Jan 21, 2023

Is Space-b not enough?

@gabydd
Copy link
Member

gabydd commented Jan 21, 2023

I believe this issue is about searching the actual text in all the open buffers

@ontley
Copy link
Contributor

ontley commented Jan 21, 2023

Ahh sorry my bad, I might look into actually working on it then

@pascalkuthe
Copy link
Member

#5652 allows global_search to use the content of buffer instead of reloading buffers from disk (which lead to weird mismatches before).
That PR wraps the helix buffer datat structure (Rope) so it can be effticely searched with grep_searcher.
Based on that work it should be pretty easy to add a version that iterates all document instead of using a WalkBuilder (and keep the logic inside the file iteration the same)

@rcorre
Copy link
Contributor

rcorre commented Feb 4, 2023

Should you need to type a search term first (similar to space-/), or should it just open a picker right away (similar to space-f, space-S`, etc.) filled with all lines?

I've been missing the latter, which I had in nvim from fzf.vim's :Lines command.

@pascalkuthe
Copy link
Member

you need to type the search regex first altough there are efforts to make the regex search incremental, see #4687.

Fuzzy matching on lines instead of performing a regex search could also be interesting but that would probably be a second picker closer to #3462. There are some strong performance caveats with that as it essentially requires loading all files into memory (and keeping them there). I have some ideas how to avoid the issue of cloning each line if the search was constrained to open buffers (or the current) tough. That is probably the more useful application too. However for a feature like that we would want the fuzzy matching to be partially async (so it runs synchronously when fast enough but asynchronously when not, maybe we can come-up with an even smarter strategy).

@the-mikedavis the-mikedavis removed E-good-first-issue Call for participation: Issues suitable for new contributors E-easy Call for participation: Experience needed to fix: Easy / not much labels Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

7 participants