warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
20.87k stars 355 forks source link

History from other terminals/sessions not synced to warp's history and vice versa #3422

Open vamshiaruru32 opened 1 year ago

vamshiaruru32 commented 1 year ago

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

dannyneira commented 1 year ago

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.

vamshiaruru32 commented 1 year ago

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

zachbai commented 1 year ago

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.

vamshiaruru32 commented 1 year ago

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?

zachbai commented 1 year ago

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

dannyneira commented 1 year ago

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

Avivbens commented 5 months ago

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

We'd super appreciate this option support, I think this is a huge time saver 🙏

SilentGlasses commented 3 months ago

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.

SilentGlasses commented 3 months ago

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

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.