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
21.1k stars 360 forks source link

don't show duplicated history items #4639

Open hferreiro opened 6 months ago

hferreiro commented 6 months ago

Discord username (optional)

No response

Describe the solution you'd like?

When going through the history, I'd expect to not see duplicated entries. This is especially wrong when those entries appear together.

Is your feature request related to a problem? Please describe.

No response

Additional context

No response

How important is this feature to you?

4

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

None

dannyneira commented 6 months ago

Hi @hferreiro sorry to hear about this, I'm not seeing the same issue on my end, what os are you on? have any history completion plugins in your rc file? Can you show a video or screenshots of the issue to help us better understand?

hferreiro commented 6 months ago

I'm using macOS. I have these options regarding history in my .zshrc file:

HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt bang_hist                 # Treat the '!' character specially during expansion.
setopt extended_history          # Write the history file in the ":start:elapsed;command" format.
setopt inc_append_history        # Write to the history file immediately, not when the shell exits.
setopt share_history             # Share history between all sessions.
setopt hist_expire_dups_first    # Expire duplicate entries first when trimming history.
setopt hist_ignore_dups          # Don't record an entry that was just recorded again.
setopt hist_ignore_all_dups      # Delete old recorded entry if new entry is a duplicate.
setopt hist_find_no_dups         # Do not display a line previously found.
setopt hist_ignore_space         # Don't record an entry starting with a space.
setopt hist_save_no_dups         # Don't write duplicate entries in the history file.
setopt hist_reduce_blanks        # Remove superfluous blanks before recording entry.
setopt hist_verify               # Don't execute immediately upon history expansion.
setopt hist_beep                 # Beep when accessing nonexistent history.

I'm also attaching a video.

https://github.com/warpdotdev/Warp/assets/984737/f5195090-7aa4-4bb5-b8a9-44699bef3ff0

hferreiro commented 6 months ago

It looks like entries are not duplicated if the command is run from the same directory as a previous run. Once you run it from a different directory, the command is duplicated in history.

SilentGlasses commented 4 months ago

This is not a Warp issue, this issue is with ZSH, so you would need to ask the ZSH devs.

As you mentioned @hferreiro, I too have similar settings in mine and it appears that in the history file you may have stragglers that show but if you run history on shell it should not display any duplicates which I have verified...

Here are my settings that work perfectly as intended...

# 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
syabro commented 3 months ago

@SilentGlasses not sure. My .zsh_hisrtory contains only timestamps and commands. But warp show me the folder where it was run plus branch.

image
syabro commented 3 months ago

@dannyneira what do you say about warp.sqlite's commands table? Looks like it stores all commands and Warp's history grouping uses at least command + pwd columns instead of just command

image