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

Have the history menu cycle the entire history, with the same filtering as ^R #550

Closed
marlonrichert opened this issue Mar 1, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@marlonrichert
Copy link
Owner

marlonrichert commented Mar 1, 2023

when doing history search, if the command I'm looking for isn't in the 16 displayed, how can search further back? If I keep pressing "up arrow", it just cycles back to the bottom of the list.

Originally posted by @wtfzambo in #459 (comment)

@marlonrichert
Copy link
Owner Author

Now available on main. @wtfzambo Please update and let me now if it doesn't work for you.

@wtfzambo
Copy link

wtfzambo commented Apr 6, 2023

@marlonrichert fantastic, it works great! I'll keep you posted if I find anything strange.

I have another question and a suggestion:
Is it possible to control the matching behavior when doing history search? For example instead of fuzzy search, match on the word being typed exactly? I'll show what I mean: in the gif, you see that history search matches the word poetry only at the very end, whereas before, it also show unrelated commands.

As for what regards the suggestion: I think it would be cool if history search would show only unique entries. Imagine something like this:

image

@marlonrichert
Copy link
Owner Author

Is it possible to control the matching behavior when doing history search? For example instead of fuzzy search, match on the word being typed exactly?

I'm further fine-tuning it as we speak. Not sure yet how I could make it configurable in a meaningful, understandable way. Let's talk again after I've released the next version of this feature.

I think it would be cool if history search would show only unique entries.

If you want to see unique entries only, add setopt HIST_FIND_NO_DUPS to your .zshrc file.

@wtfzambo
Copy link

wtfzambo commented May 3, 2023

Thanks man, you're the best!

@emilyst
Copy link

emilyst commented May 7, 2023

It looks like you added some code that looks for the option HIST_FIND_NO_DUPS and uniques the list of suggested history if it's set (among other things). This makes sense, but I think it may cause an issue for people who have this option set and who have large histories.

Unfortunately, I've accumulated over 44K history entries (since I never throw history away). Therefore, _autocomplete.history_lines takes about four minutes to run on my system (and then eventually seems to fail anyways).

Since I've had HIST_FIND_NO_DUPS set all along, it isn't really helping me to unique the suggestions. I imagine most of the people with HIST_FIND_NO_DUPS set will not benefit from this, since they're unlikely to have duplicate entries in their history file. And those without it set are more likely to benefit from it.

Maybe the right way to go is to unique that list if it's not set?

@marlonrichert
Copy link
Owner Author

marlonrichert commented May 9, 2023

HIST_FIND_NO_DUPS does not prevent dups from being saved to hist file. It only prevents the built-in hist widgets from showing dups; it does not prevent dups from showing up anywhere else. HIST_SAVE_NO_DUPS prevents saving dups to file. See https://zsh.sourceforge.io/Doc/Release/Options.html#History

@emilyst
Copy link

emilyst commented May 9, 2023

HIST_FIND_NO_DUPS does not prevent dups from being saved to hist file. It only prevents the built-in hist widgets from showing dups; it does not prevent dups from showing up anywhere else. HIST_SAVE_NO_DUPS prevents saving dups to file. See https://zsh.sourceforge.io/Doc/Release/Options.html#History

Ah, sorry, I misread. Thanks.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants