sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.22k stars 977 forks source link

Bug: pure + iterm2 + iterm2 plugin + iterm2 shell integration breaks Cmd-K (Clear Buffer) #680

Closed jamesdh closed 2 months ago

jamesdh commented 5 months ago

General information

When using pure w/ iterm2, the iterm2 zsh plugin, and the plugins ability to enable the iterm2 shell integration, the shortcut for clearing the terminal (Cmd-K) is broken, and instead exhibits inconsistent but broken behavior. Sometimes it fixes the cursor to the bottom of the terminal. Sometimes it simply does nothing. Sometimes it will correctly clear the screen. Pressing Ctrl-L restores it to the top of the terminal.

System report (output of prompt_pure_system_report):

Other information

I have:

Problem description

iTerm2 native shortcut to clear the terminal buffer is broken by combination of pure theme, iterm2 zsh plugin, and enabling shell integration via said plugin.

Reproduction steps

  1. Add iTerm2 plugin, e.g. plugins=(iterm2...)
  2. Enable iTerm2 shell integration via plugin, e.g. zstyle :omz:plugins:iterm2 shell-integration yes
  3. Open iTerm2
  4. Perform any generic command to generate output
  5. Press Cmd-K
  6. Potentially repeat once or twice and you should see the unexpected behavior.

My .zshrc:

ZSH_THEME=""
export ZSH="$HOME/.oh-my-zsh"
zstyle :omz:plugins:iterm2 shell-integration yes
plugins=(iterm2)
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
autoload -U promptinit; promptinit
prompt pure
source $ZSH/oh-my-zsh.sh
mafredri commented 5 months ago

I can't reproduce this behavior with iTerm2 shell integration and Pure (without OMZ).

Could you try swapping the order there at the end?

source $ZSH/oh-my-zsh.sh

autoload -U promptinit; promptinit
prompt pure
jamesdh commented 5 months ago

@mafredri that actually appears to have fixed it for me. What made you think to suggest that?

EDIT: nevermind...I see your and Pure (without OMZ). comment above!