Closed carsanbu closed 1 year ago
I have noticed this as well and just opened an issue and a PR in the oh-my-zsh repo to address it. Fortunately the bug and associated fix seem pretty simple.
Vim mode is, well, modal, meaning there are different modes. Each mode has independent keybindings, so if you want a single action to work the same way in both insert and command mode, you need to create identical keybindings for each.
The bug here seems to stem from the fact that this plugin doesn't consider vim modes. There's just a single keybinding mapping ^G to the toggle behavior. Consequently, with bindkey -v
active, the behavior that ^G is mapped to is applied to whichever vim mode the shell starts in, which is insert by default. Then when you change to command mode, ^G is no longer mapped to the desired behavior, so it doesn't work.
TLDR: The solution seems simply to create a parallel keybinding for vim command mode.
Anyway, this repo is clearly the source for the plugin in the oh-my-zsh repo where I submitted my other PR, but the two repos appear unconnected. So I'll open a parallel PR here and just try to keep the two in sync if/as they change.
Update: I just opened #50 to address this.
Fixed by #50
FWIW I ran into the same issue w/ the zsh-vi-mode plugin and in order to fix the issue I had to initialize this plugin in a zsh-vi-mode helper function and include it in the ohmyzsh plugins
array. I've included more details in this comment in case there's an underlying issue you can address @jimhester.
@diminutivesloop Is your source code up to date?
Try pulling from master
and see if you still have the issue. I recently submitted a PR (#50) which I thought resolved this.
@cohml Yes I have the latest pulled and I still see the issue. I'm using the version bundled w/ ohmyzsh and I see your changes from https://github.com/ohmyzsh/ohmyzsh/pull/11808 in the local commit history.
@diminutivesloop Strange. Is the keybinding broken in insert and command mode, or just one?
@cohml It's broken in both
I want to use the vi mode with this awesome plugin but when I enable it the global/local switch stops working.
How to reproduce
ZSH version
zsh 5.9 (x86_64-debian-linux-gnu)