zsh-vi-mode
zsh-vi-mode copied to clipboard
Two preceding line gets removed when using zsh-vi-mode with powerlevel10k inside tmux
Asciinema
https://asciinema.org/a/gxwaBQ4dmYTMnJ2gNgyGH0Q0L
Steps to reproduce
- Install Oh My Zsh
- Install https://github.com/jeffreytse/zsh-vi-mode
- Install powerlevel10k
- Enable transient prompt.
- Open zsh inside tmux
- Go to insert mode and back to normal mode.
Minimal repro
docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -w /root -it --rm alpine sh -uexc '
apk add curl git zsh tmux
curl -fsSLO https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
sh ./install.sh --unattended --skip-chsh </dev/null
git clone --depth=1 https://github.com/jeffreytse/zsh-vi-mode.git ~/.oh-my-zsh/custom/plugins/zsh-vi-mode
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
cp ~/.oh-my-zsh/custom/themes/powerlevel10k/config/p10k-lean.zsh ~/.p10k.zsh
sed -i.bak -E "s|POWERLEVEL9K_TRANSIENT_PROMPT=.*|POWERLEVEL9K_TRANSIENT_PROMPT=always|" ~/.p10k.zsh
sed -i.bak -E "s|^ZSH_THEME=.*|ZSH_THEME=powerlevel10k/powerlevel10k|" ~/.zshrc
sed -i.bak -E "s|^plugins=.*|plugins=(zsh-vi-mode)|" ~/.zshrc
echo "source ~/.p10k.zsh" >>~/.zshrc
echo "set -g default-command \"exec zsh\"" >>~/.tmux.conf
exec tmux'
See also https://github.com/romkatv/powerlevel10k/issues/1618#issuecomment-955651678
Hi @itsfarseen
Thanks for your issue, currently I am busy, I will try to work on this issue as soon as possible.
Thanks and Regards
sed -i.bak -E '/zle \.?reset-prompt/d' ~/.oh-my-zsh/custom/plugins/zsh-vi-mode/zsh-vi-mode.zsh
Removing zle reset-prompt
fixes the issue and doesn't seem to break anything.
Ref https://github.com/romkatv/powerlevel10k/issues/1618#issuecomment-955656371
Hi @itsfarseen
Actually, it will break the vi mode indicator when user custom their prompt by the aspect. Besides, there are several places will call reset-prompt
to redraw the content.
Thanks and Regards
Ooh. For some reason, the current theme I use powerlevel10k, which has mode indicators, still works correctly.
I think this theme does the refresh automatically. Could you make the refresh configureable? So that when people have themes like this they can let the theme do the refresh?
Hi @itsfarseen
Thanks for your information, I will take a further research on this issue, as some cases need to be reset the prompt properly (e.g. #120), and look forward to the best solution, once I got progress, I will let you know. And welcome to star this project for further update in the future.
Thanks and Regards
This issue is related to #124.
The same thing happens with my custom prompt, so it probably affects all 2-line prompts
I found that this line contains a reset prompt command that happens every time zvm_select_vi_mode()
is called, which when commented out (mostly) resolved the issue of the last line getting erased in tmux for me. I don't know if this will break other things or work for other people, but it may give an idea of where this bug is coming from.
I found that this line
Thanks for the hint @awray3 . I found that removing that one line from the current master on this version of zvm somewhat helps, but spamming <esc>
still results in weird behavior.
I applied your suggestion to my own fork of the project, after reverting the changes mentioned here and now things are working fine with zsh+zvm+tmux for me.