jeffreytse / zsh-vi-mode

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

Regression in prompt resetting #219

Closed ajvondrak closed 9 months ago

ajvondrak commented 1 year ago

General information

Basic examination

Problem description

I have a custom PROMPT that relies on prompt_subst to change based on whether I'm in Vi mode. However, upon upgrading zsh-vi-mode, this prompt stopped switching at all.

Reproduction steps

  1. Configure a custom prompt:
    setopt prompt_subst
    PROMPT='$(custom_prompt)'
    custom_prompt() {
      if [[ $KEYMAP == "vicmd" ]]; then
        echo -n "vi cmd mode: "
      else
        echo -n "insert mode: "
      fi
    }
  2. Hit <esc>/i to toggle between insert mode & vi cmd mode.
    • Expect: prompt to change between vi cmd mode: and insert mode:
    • Actual: prompt stays insert mode:
  3. Upon reverting 5979662a11e139a3a87872d1a5282c836e98e608 (and doing a zgenom reset and everything to make sure I'm running an up-to-date zsh-vi-mode plugin), the above test toggles the prompt properly.

Expected behavior

I'm not sure what issue #180 was fixing (I don't use tmux), but the fix that got merged appears to cause this regression. It looks related to the prompt-resetting logic changes.

ajvondrak commented 1 year ago

Might be related to / a duplicate of #213?

jeffreytse commented 1 year ago

Hi @ajvondrak

Thanks for your reporting. I still need some time to investigate this issue, please be patient for the update.

Thanks & Regards

ajvondrak commented 1 year ago

Understood & much appreciated. 🙏 In the meantime, I can work locally by just reverting the commit in question, so I'm not really hurting too much. Thanks for all the great work on this plugin!

Message ID: @.***>

jeffreytse commented 9 months ago

Hi @ajvondrak,

Could you please check again with the latest commit? See if your issue has been settled down. : )

Thanks & Regards

ajvondrak commented 9 months ago

Just tried against a3d717831c1864de8eabf20b946d66afc67e6695, and my prompt works! 🎉

And to double-check, I went ahead and did a git checkout HEAD^ on zsh-vi-mode a few times by hand until the prompt stopped working. Findings:

Indicating that fb2f825bf01012786b9a327e5e3c2085d8d18ae5 was indeed the first commit to fix my problem (as noted, #243 tracked the fix to this issue as well). 👍

Thanks so much for the work here!