jeffreytse / zsh-vi-mode

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

Switching modes don't trigger an auto reset prompt #243

Closed jeffreytse closed 9 months ago

jeffreytse commented 9 months ago

General information

Please report the following information as possible as you can:

Basic examination

Problem description

Switching modes doesn't trigger an auto reset prompt when users have a custom prompt string for mode indicator.

Reproduction steps

  1. Change .zshrc file as below:
setopt prompt_subst
PROMPT='$(custom_prompt)'

custom_prompt() {
  if [[ $KEYMAP == "vicmd" ]]; then
    echo -n "vi cmd mode: "
  else
    echo -n "insert mode: "
  fi
}

source ~/zsh-vi-mode/zsh-vi-mode.zsh
  1. Open terminal and enter zsh
  2. Switch between INSERT and CMD modes via ESC and i
  3. The prompt doesn't change between vicmd mode: and insert mode:

Expected behavior

The prompt should be auto changed as expectation.

jeffreytse commented 9 months ago

Related to #219