jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
2.99k stars 103 forks source link

Fixes terminal from deleting previous line on ESC #180

Closed scresante closed 1 year ago

scresante commented 2 years ago

reverts a number of changes and fixes #136 #124 in tmux

nwaywood commented 1 year ago

This fixes the issue for me 🎉 Is there any reason why this isn't being merged?

jeffreytse commented 1 year ago

Hi @scresante @nwaywood

I'd love to merge this PR, but still need some time to get it test, thanks for waiting a longtime.

Best Regards

julianKatz commented 1 year ago

Any update? Would love to get this fixed.

Ghasak commented 1 year ago

Hi Mr. @jeffreytse Please could you remove this comment from your beautiful repository? everything was working amazingly until this merge. the problem is that when I hit Esc the indicator (added a text in zvm_after_select_vi_mode say INSERT in ZVM_MODE_INSERT and NORMAL in ZVM_MODE_NORMAL . It shows now that the zvm_after_select_vi_mode doesn't switch on fly the text, instead, I need to hit enter! it happens after you approve this change! check my code below if I miss something

function zvm_before_init(){
        PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{#EF7A85}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
        PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{#533344}%F{#EF7A85}INSERT%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
        PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
        RPROMPT=$'%F{blue}ó°”› %F{white}:%F{180}${prompt_elapsed_time} %F{yellow}${SYNC_ICON}%{$reset_color%} %{$fg[magenta]%}[ ${Date_ICON} %F{110} %D{%b %d, %Y}${PR_NO_COLOUR} - %{$fg[magenta]%}${CLOCK_ICON}%F{180} %D{%L:%M:%S %p}%{$fg[magenta]%} ] %{$reset_color%}'
}

# The plugin will auto execute this zvm_after_select_vi_mode function
# #The plugin will auto execute this zvm_after_select_vi_mode function
# #It will overwrite the initial prompt: zvm_before_init_commands
function zvm_after_select_vi_mode() {
  case $ZVM_MODE in
    $ZVM_MODE_NORMAL)
    # Something you want to do...
    PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{#94C9A9}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
    PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{#37505C}%F{#94C9A9}NORMAL%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
    PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
    ;;
    $ZVM_MODE_INSERT)
    # Something you want to do...
    PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{#EF7A85}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
    PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{#533344}%F{#EF7A85}INSERT%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
    PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
    ;;
    $ZVM_MODE_VISUAL)
      # Something you want to do...
    PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{208}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
    PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{#4E3651}%F{#EFC3F5}VISUAL%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
    PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
    ;;
    $ZVM_MODE_VISUAL_LINE)
      # Something you want to do...
    PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{208}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
    PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{239}%F{206}VISUAL*%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
    PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
    ;;
    $ZVM_MODE_REPLACE)
      # Something you want to do...
    PROMPT=$'%F{blue}\u256D\U2500${OS_ICON} %F{208}%n%f ${AT_SYMPOLE} ${MAC_ICON} %F{229}%m% ${PR_NO_COLOUR} on %F{#88c0d0}%~%f%F{%(0?.green.red)} %(0?.\uf08b.\uf071)  %F{140}$(GPS)  '
    PS1+=$'\n%F{blue}${MULTILINE_NEWLINE_PROMPT_PREFIX}${ROBOT_ICON} %K{239}%F{200}REPLACE%{$reset_color%}%4v%f%F{120}%F{180}%F{blue}%{$reset_color%} %F{yellow}%1v%{$reset_color%} %K{239}$(git_time_since_commit)${PR_NO_COLOUR}${GITSTATUS_PROMPT:+$GITSTATUS_PROMPT} $(virtualenv_info)'
    PS1+=$'\n%F{blue}\u2570${RULER_CHAR}%F{blue}${ARROW}%{$reset_color%} ' #
    ;;
  esac
  RPROMPT=$'%F{blue}ó°”› %F{white}:%F{180}${prompt_elapsed_time} %F{yellow}${SYNC_ICON}%{$reset_color%} %{$fg[magenta]%}[ ${Date_ICON} %F{110} %D{%b %d, %Y}${PR_NO_COLOUR} - %{$fg[magenta]%}${CLOCK_ICON}%F{180} %D{%L:%M:%S %p}%{$fg[magenta]%} ] %{$reset_color%}'
}