-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[zsh] Reload shared history before searching #2251
Conversation
Last commit only reloads new history events, this prevents the event number of existing history entries from changing (which happens when you reload the entire history). |
Merged, thanks! |
This change has introduced a noticeable latency when using CTRL-R. On my system (arch/5.9.12 on lenovo t470s) this amounts to around 0.6 seconds:
I would suggest making this behavior optional since having to wait half a second for each CTRL-R is kind of draining :) |
@KimNorgaard Thanks for letting me know. I'm going to have to revert this for now since 0.59s is unacceptable. |
This reverts commit b62a74b. #2251 (comment)
And it looks like we don't need an option for this as one can write a function that calls |
Reverting is fine, it's 0.071s for me though. @KimNorgaard Just curious, how big is your history? ( |
It's 10000 lines which is my HISTSIZE. Timing fc -l 0 is 0.12s. |
Is this a spinning disk by any chance? Strange that it would be so slow. On my 3 year old MBP:
|
Nah it's an NVME. |
Right so I found out if I experiment with HISTSIZE things move a lot faster. I have both HISTSIZE and SAVEHIST set to 10000 but I'm not sure yet why that would impact searching history. Anyway if I set HISTSIZE to a value a bit higher than the actual number of saved commands, e.g. 10010 then things run smoothly. |
I'm guessing |
Yeah, I think you are right, however it's pretty normal to set your HISTSIZE and SAVEHIST to the same value in which case this is bound to happen sooner or later, right? As long as no shifting is going on everything will be fast, though. |
I noticed the same delay as @KimNorgaard and found this commit and the revert on master. |
Index remains unchanged for me. What other options do you have ( |
Sorry for the long delay. Here are my setopts:
It's probably the default ohmyzsh configuration. IIRC the problem only happened with multiple tmux panes. But even then I couldn't reproduce it reliably. |
When history sharing across shells is enabled (
setopt SHARE_HISTORY
), history written by shell A won't be available in shell B until re-rendering the prompt in B (e.g. by pressing Enter at the prompt).With this change, C-r will always reload the history file if history sharing is enabled, making the latest history searchable immediately.