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

CTRL+R (reverse search) results are reset after shell is closed #1002

Closed
1 task done
therealpaulgg opened this issue Sep 25, 2021 · 7 comments
Closed
1 task done

CTRL+R (reverse search) results are reset after shell is closed #1002

therealpaulgg opened this issue Sep 25, 2021 · 7 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@therealpaulgg
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

After closing a shell (ZSH) on Linux (both WSL and SSH), the CTRL+R results do not show up after logging back into the Linux system (also affects searching with up + down arrow keys). In regular bash, zsh, and oh-my-zsh, after logging off and logging back on, command history is preserved.

The ctrl+r functionality works perfectly fine on Windows after closing/reopening Powershell on Windows.

Version

5.6.0. Have tested both the winget Windows version (includes oh-my-posh-wsl), as well as a native Linux install on one of my machines. Both have the same problem.

Theme

blue-owl, lightly customized. https://gist.github.com/therealpaulgg/9aabf3235278a3227b6daff1fcc52837

What OS are you seeing the problem on?

Windows, Linux

Which shell are you using?

zsh, powershell

Relevant log output

No response

@therealpaulgg therealpaulgg added the 🐛 bug Something isn't working label Sep 25, 2021
@lnu
Copy link
Contributor

lnu commented Sep 26, 2021

you mean this(sorry for the quality):
Screencast from 26-09-21 07 16 07

bcksearch

I tried on an opensuse tumbleweed and on windows with wsl. With or without omp enabled, different themes.
I Opened/Closed the terminal, reboot and the history and the backward search seem to work. Am I missing something?

@JanDeDobbeleer
Copy link
Owner

If memory serves me right, we've had someone stumble upon this before.

@lnu
Copy link
Contributor

lnu commented Sep 26, 2021

You have a good memory... I completely forgot about that one

@therealpaulgg
Copy link
Author

Yes, it turns out that in order to make ZSH history work you have to configure it yourself. It seems to be auto-configured for history when using oh-my-zsh or if you set up ZSH initially with option (1). Thanks for linking that issue, that really helps. Led me to this which solved it:

https://unix.stackexchange.com/questions/389881/history-isnt-preserved-in-zsh

Added these lines to .zshrc:

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

Apologies for not knowing enough about zsh to have to open this issue, lol. Hopefully this helps someone out in the future.

@JanDeDobbeleer
Copy link
Owner

I'll create a FAQ item about this. As we want to be careful overriding people's settings, I don't want to add this to our init script, but it's really useful to know if you encounter this.

@lnu
Copy link
Contributor

lnu commented Sep 26, 2021

Yes, it turns out that in order to make ZSH history work you have to configure it yourself. It seems to be auto-configured for history when using oh-my-zsh or if you set up ZSH initially with option (1). Thanks for linking that issue, that really helps. Led me to this which solved it:

https://unix.stackexchange.com/questions/389881/history-isnt-preserved-in-zsh

Added these lines to .zshrc:

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

Apologies for not knowing enough about zsh to have to open this issue, lol. Hopefully this helps someone out in the future.

I found the links to solve the issue months ago and still I forgot about it, so don’t be sorry :)

Copy link

github-actions bot commented Apr 1, 2024

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues.
If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants