jeffreytse / zsh-vi-mode

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

Conflicts with zsh-autosuggestions setting #57

Closed g6ai closed 3 years ago

g6ai commented 3 years ago

I'm using oh-my-zsh to manage plugins. With zsh-vi-mode enabled, this zsh-autosuggestions setting:

bindkey '^ ' autosuggest-accept 

is not working, specifically I cannot use ctrl-space to complete autosuggestions. I can only use the default right-arrow key to complete.

jeffreytse commented 3 years ago

Hi @g6ai

Could you update your plugin to the latest version and check again? I just test it and this issue has not appeared.

Thanks and regards

g6ai commented 3 years ago

Thanks for the reply! I've just updated the plugin (by running git pull in the plugin's directory), and modified the oh-my-zsh plugin config line to

plugins=(git pyenv zsh-autosuggestions zsh-syntax-highlighting thefuck zsh-vi-mode)

But the problem persists...

g6ai commented 3 years ago

Apart from the above line, my current entire .zshrc is here: https://github.com/g6ai/dotfiles/blob/275ba75df6a1f93b01d2525ae63a90929400dd24/zsh/zshrc#L1-L30

I'll try to disable other settings to see if I can resolve this

g6ai commented 3 years ago

I've tried disabling all my custom setting, only leaving basic oh-my-zsh lines and two plugins:

### start of oh-my-zsh ###
export ZSH="$HOME/.oh-my-zsh"

plugins=(zsh-autosuggestions zsh-vi-mode)

source $ZSH/oh-my-zsh.sh

# Put plugins config after this line
# zsh-autosuggestions
bindkey '^ ' autosuggest-accept

# zsh-vi-mode
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK
### end of oh-my-zsh ###

still not solved. More info on my setup:

OS: macOS 10.14.6 (for 32-bit compatibility reason I have to stay at this version) Terminal: I tried both Terminal.app and iTerm2.app, same results

Please let me know if I can provide any further info, thanks!

jeffreytse commented 3 years ago

Hi @g6ai

Thanks for the reporting and the details. This issue has been addressed and fixed. Please update your plugin to the latest version.

Thanks and regards

g6ai commented 3 years ago

The updated plugin still does not work...

jeffreytse commented 3 years ago

Hi @g6ai

So that it's another problem caused this issue. I will do further test about your case, any other issue I will update here.

Thanks and regards

jeffreytse commented 3 years ago

Hi @g6ai

Could you provide me the commit hash code in your local repository of zsh-vi-mode?

Thanks and regards

g6ai commented 3 years ago

Thank you very much. I searched around and used this way to verify if this is a problem on my terminal, by using this key-binding in .zshrc:

bindkey '^@' self-insert

And when I type ctrl-, ^@ is printed in the terminal. So it should not be a problem on the terminal.

g6ai commented 3 years ago
❯ git log | head
commit d354b6d85e1d82f5a9f5246ff99aa78b86fc5c22
Author: jeffreytse <jeffreytse.mail@gmail.com>
Date:   Mon Mar 15 19:13:27 2021 +0800

    fix: binding ctrl-<space> does not work (#57)

    This commit fixed the issue that `ctrl-<space>`, that is the control
    character `^@` could not be escaped to a printable character.
❯ git rev-parse HEAD
d354b6d85e1d82f5a9f5246ff99aa78b86fc5c22
jeffreytse commented 3 years ago

Hi @g6ai , also, you run the command bindkey -M viins | grep accept and provide the content to me.

g6ai commented 3 years ago
❯ bindkey -M viins | grep accept
"^J" accept-line
"^M" accept-line
jeffreytse commented 3 years ago

@g6ai , accordingly, the keybinding ^@ has not been bound successfully in your environment, but my side can show it is bound by the above command.

g6ai commented 3 years ago

I see, although I don't understand the mechanism of this :) Could you inform me what to do for this keybinding working properly?

jeffreytse commented 3 years ago

@g6ai, could you try the below snippet:

# Put it to the `.zshrc` file
function zvm_after_init() {
  zvm_bindkey viins '^@' autosuggest-accept
}
g6ai commented 3 years ago

@jeffreytse The snippet works! Thank you very much!