Clearing a line in vi mode removes the line above
I am starting zsh in VI mode with a two-line prompt. Whenever I clear a line using "cc", the line above my tooltip is removed. For example. if i start with
magnus@tatooine 2502 ~
[I] %
magnus@tatooine 2502 ~
[I] %
Then I press escape and 'cc' I get
magnus@tatooine 2502 ~
magnus@tatooine 2502 ~
[I] %
It is very repeatable; I can clear the terminal by repeating the sequence several times. What do I need to do to get ZSH to clear the line without deleting the line above it?
My tooltip is generated with the following
zstyle ':vcs_info:*' enable git hg svn
zstyle ':vcs_info:(git*|hg*)' get-revision true
zstyle ':vcs_info:(git*|hg*)' check-for-changes true
zstyle ':vcs_info:git*' formats "(%s: %12.12i %c%u %b)" # hash changes branch
zstyle ':vcs_info:git*' actionformats "(%s(%F{yellow}%a%f): %12.12i %c%u %b)"
zstyle ':vcs_info:hg*:*' branchformat "%b" # only show branch
zstyle ':vcs_info:(hg*|git*):*' stagedstr "%F{green}S%f"
zstyle ':vcs_info:(hg*|git*):*' unstagedstr "%F{red}U%f"
zstyle ':vcs_info:git*+set-message:*' hooks git-st git-stash git-untracked
# improve the ZSH prompt in vi mode
function zle-line-init zle-keymap-select {
case ${KEYMAP} in
(main) prompt_vi_mode="%F{yellow}[I]%f"
;;
(vicmd) prompt_vi_mode="%F{red}[N]%f"
;;
esac
prompt_line1="%F{green}%n@%m%f %F{red}%h%f ${vcs_info_msg_0_} %F{blue}%~%f"
prompt_line2="${prompt_vi_mode} %B%#%b "
PS1="${prompt_line1}${prompt_newline}${prompt_line2}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
+3
source to share
No one has answered this question yet
Check out similar questions: