History from other terminals/sessions not synced to warp's history and vice versa
Discord username (optional)
No response
Describe the bug
I have warp running, and I also have an integrated terminal in vscode. The commands I insert from vscode's integrated terminal don't appear in warp's auto complete, and commands input in warp don't come in vscode. However, vscode's integrated terminal history is available in regular terminal. So it looks like warp is not storing history in the same place as every other terminal?
Any help is appreciated, thank you.
To reproduce
Execute a command from vscode integrated terminal, and try to get to that command from warp by starting to type the command and then clicking the up arrow button.
Expected behavior
I expect the command to appear.
Screenshots
No response
Operating system
MacOS
Operating system and version
Ventura 13.3 (22E252)
Shell Version
zsh 5.9 (x86_64-apple-darwin22.0)
Current Warp version
v0.2023.07.18.08.03.stable_00
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
No
Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)
Yes, this I confirmed this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e
None
Hey @vamshiaruru32 Thanks for letting us know. I tried running commands on terminal, iterm, warp, and vscode, yet they don't sync across any of them, even if I start a new tab(session) on each and run the history command, I'm not seeing them synced.
Is there a setting you may have set in vscode that enables this? Could you please provide a video of the issue and if possibe some configuration that may enable this?
As a possible workaround, we have a vscode "integration" which you can learn more about here, but essentially you'd have to use Warp exclusively for the time being for it to keep the session history.
To anyone else facing this issue, please add a :+1: to the original post at the top or comment with your details, and subscribe if you'd like to be notified.
Hi @dannyneira , sure here's a video recording. As you can see the history syncs between vscode integrated terminal and retgular terminal.
https://github.com/warpdotdev/Warp/assets/132186130/12811de7-60eb-4985-b64a-46bff9a6e196
Hey @vamshiaruru32,
Warp reads shell history from the same file (~/.zsh_history) used by any other zsh session in any other terminal emulator. The issue is that Warp loads history from that file only on session start, so commands entered into zsh in another terminal emulator after Warp session startup are not picked up by Warp. This is the same behavior exhibited by default for bash and fish; it looks like zsh (or some piece of your zsh config) might actually do some histfile reloading after each command is executed.
Unfortunately, we're unlikely to implement this in the near term, but your feedback is heard and appreciated -- its something we could consider adding to the longer term roadmap.
Thanks @zachbai , I understand. Is there a way to force warp to reload history short of quitting completely and reopening it? I understand auto reload isn't in the plan, but perhaps an on demand reload?
There isn't an existing way to force a histfile reload "on-demand" at the moment, but its possible we could introduce a solution in the future. We'll follow up on this thread with any relevant updates
#3479 noted that zsh options like share_history which allow updating the history for each command for all the current zsh sessions are not supported
#3479 noted that zsh options like
share_historywhich allow updating the history for each command for all the current zsh sessions are not supported
We'd super appreciate this option support, I think this is a huge time saver 🙏
This has to do with your ZSH settings and of course Apple's idiotic decisions forced on it's users..
Basically what's happening is that by default ZSH on Apple machines has per session which blocks your history from being written to a single file that all your sessions and terminals can reference.
Here is how I handle history in zsh which includes sharing it across sessions and terminals:
# Better History
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt APPEND_HISTORY # Write to history
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_NO_STORE # Don't store history commands
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_SAVE_NO_DUPS # Older duplicates are omitted.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
SHELL_SESSION_HISTORY=0 # Disable pert-terminal-session
ps, this works on Linux as well.
#3479 noted that zsh options like
share_historywhich allow updating the history for each command for all the current zsh sessions are not supported
Did something change recently on Warp? I have this functionality working just fine with my settings above. I am running the most recent version both on Mac and Linux and I have no issues.
Upvotting the feature request, I think it will a huge improvement.
Would love to see this implemented
+1
This is a dealbreaker. Not being able to find my commands because they were run in different tabs is enough for me to find a different terminal. No feature of warp is more valuable than a reliable command history.
This has to do with your ZSH settings and of course Apple's idiotic decisions forced on it's users..
Basically what's happening is that by default ZSH on Apple machines has per session which blocks your history from being written to a single file that all your sessions and terminals can reference.
Here is how I handle history in zsh which includes sharing it across sessions and terminals:
# Better History #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= HISTFILE="$HOME/.zsh_history" HISTSIZE=10000000 SAVEHIST=10000000 setopt APPEND_HISTORY # Write to history setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history. setopt HIST_FIND_NO_DUPS # Do not display a line previously found. setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate. setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again. setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. setopt HIST_NO_STORE # Don't store history commands setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry. setopt HIST_SAVE_NO_DUPS # Older duplicates are omitted. setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. setopt SHARE_HISTORY # Share history between all sessions. SHELL_SESSION_HISTORY=0 # Disable pert-terminal-sessionps, this works on Linux as well.
Not working on a remote centos server for me, is there another workaround?
But in Warp, even with these settings, I still don't see the history shared between tabs. Only when I open a new tab it sees the recent changes.
On Wed, Feb 5, 2025 at 10:28 PM Thomas Weber @.***> wrote:
This has to do with your ZSH settings and of course Apple's idiotic decisions forced on it's users..
Basically what's happening is that by default ZSH on Apple machines has per session which blocks your history from being written to a single file that all your sessions and terminals can reference.
Here is how I handle history in zsh which includes sharing it across sessions and terminals:
Better History
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= HISTFILE="$HOME/.zsh_history" HISTSIZE=10000000 SAVEHIST=10000000 setopt APPEND_HISTORY # Write to history setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history. setopt HIST_FIND_NO_DUPS # Do not display a line previously found. setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate. setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again. setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. setopt HIST_NO_STORE # Don't store history commands setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry. setopt HIST_SAVE_NO_DUPS # Older duplicates are omitted. setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. setopt SHARE_HISTORY # Share history between all sessions. SHELL_SESSION_HISTORY=0 # Disable pert-terminal-session
ps, this works on Linux as well.
Not working on a remote centos server for me, is there another workaround?
— Reply to this email directly, view it on GitHub https://github.com/warpdotdev/Warp/issues/3422#issuecomment-2637955679, or unsubscribe https://github.com/notifications/unsubscribe-auth/BF37SY7OMJWSI7VAGNMP5T32OJYABAVCNFSM6AAAAAA2YXUTOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZXHE2TKNRXHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Vitaly Belman Frontend Guildmaster Qwilt | @.***
+1
+100 for this - Before warp, with the fish shell, I used history merge to get recent history, and I found myself typing this a bunch when I started using Warp, and then eventually lost it from muscle memory as it doesn't work.
I propose something like warp history merge to just reload the zsh and fish history files like it does at the beginning of the session. This way a user can be in control of when the history gets merged. Because, I have tried it where it updates ALL the time, and that is not a good user experience.
https://fishshell.com/docs/current/cmds/history.html
I have my zsh shell setup with my config above and I see changes real time. There has to be something in your config that's causing the refresh to not work. I run commands on one tab and see it in the other existing tab right away without having to refresh manually.
My suggestion is to clear out or shell profile directly, then start with my config above, then start adding your other configs one by one to see which is causing the issue.
This is NOT an issue with Warp.
This happens to me too, new tabs get the latest history though.
My bash history file is renamed from the default, along with some other behavior changes in accordance with the eternal history formula:
# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
As a result, warp can't find and doesn't use my real history file, which makes it less useful to me.
That is why I never blindly copy and paste things from the internet if you don't know the context behind it and don't recommend anyone to, even for my stuff.
On that note:
For all of you having this issue, please make a backup of your profile (.zshrc, .bashrc, etc) then start fresh with my base history setting. If that works for you, start adding back your other settings one by one to see what's breaking your history. I have tested my history setup on both macOS and Linux and it works just fine for me.
[!NOTE] This issue is not a Warp issue but rather how shells handle history across sessions. Here's a good explanation: https://serverfault.com/a/337154.
TLDR Shell history is built and managed this way by default to prevent data corruption and race conditions. Each shell session you open is a separate, independent process.
# Better History
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt APPEND_HISTORY # Write to history
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_NO_STORE # Don't store history commands
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_SAVE_NO_DUPS # Older duplicates are omitted.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
SHELL_SESSION_HISTORY=0 # Disable per-terminal-session
Note: For the HISTFILE="$HOME/.zsh_history" line, make sure you tell it whatever your history file and path is if you've changed it from the default.
@weber8thomas I don't think your local settings will transfer to a remote server, what I'd suggest if you want this to work on remote servers is to use infrastructure as code tools like Terraform to manage your server build if you have many and have a default profile added to the user accounts on the server, or just copy your preferences over to your server account.
I'm a bit lazy, is there a quick setting or command to fix this? This is a bug?
This issue significantly slows down my productivity, I have to find previous commands from other sessions and do some copy/paste work.
Maybe related with https://github.com/warpdotdev/Warp/issues/2302 - not sure why it's closed tbh.
Here's hoping this helps understand the issue you all are seeing and solve this once and for all..
[!IMPORTANT]
- This is not a Warp issue
- This is not a bug
- This is a shell issue.
Bash and ZSH on Linux and macOS have made it so each session has it's own history for that specific session.
If you follow my instructions and use the settings for properly setting your shell for session sharing, this issue will go away.
There is nothing really that Warp can do as they do not install your shell as part of the app.
The Fix
Please make a backup of your profile (~/.zshrc, ~/.bashrc, etc) then start fresh with my base history settings:
# Better History
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt APPEND_HISTORY # Write to history
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_NO_STORE # Don't store history commands
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_SAVE_NO_DUPS # Older duplicates are omitted.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
SHELL_SESSION_HISTORY=0 # Disable per-terminal-session
[!NOTE] For the
HISTFILE="$HOME/.zsh_history"line, make sure you tell it whatever your history file and path is if you've changed it from the default.
Once that works for you, start adding back your other settings one by one and to see what setting could potentially be breaking your history.
Reference
Here's a good explanation: https://serverfault.com/a/337154.
TLDR Shell history is built and managed this way by default to prevent data corruption and race conditions. Each shell session you open is a separate, independent process.
That's not true no matter how many times you repeat it @SilentGlasses. Many of us have this exact configuration and it works in other terminal apps but not Warp. You are the only person who claims this is working and no one else has reproduced this, so you're either not understanding what we're looking for here or you've made some other change to make this work. I stopped using Warp and this is now working. Problem solved. And I recommend anyone else frustrated by this to do the same.
For me, it seems like warp is using its own history for autocomplete
It's completely different than fish shell history
Is warp not reading from ~/.local/share/fish/fish_history?
@abed-daloopa Warp does use the fish shell history file - entries from fish sessions in past Warp sessions, and in different terminals, should appear in Warp's history completions. The constraint Zach mentioned above, where Warp only reads the history file when a new session starts, will still apply though.
If you have Next Command enabled, those suggestions also take precedence over history-based suggestions.
@bnavetta In iTerm and Ghostty, I get the latest completions from other terminals, but in Warp, I don't get them when I open a new tab.
Even if I cmd+q quit Warp and then reopen it, I'm not getting the latest commands from other terminals in Warp.
See the recording:
https://github.com/user-attachments/assets/b51004aa-3d3a-4fcc-ada3-03d8dfdb81d4