conflict with zsh-autosuggestions & zsh-syntax-highlighting
commiyou opened this issue ยท 9 comments
Thanks for this bug report! I am not familiar zsh-autosuggestions, but it appears to work OK for me. I tried a .zshrc with just:
source ~/g/zsh-vim-mode/zsh-vim-mode.plugin.zsh
source ~/Downloads/zsh-autosuggestions.zsh
And it seems to work as expected:
Can you please try the latest ZSH version and a simple test .zshrc? And then gradually add back things to your .zshrc until you can identify what causes the problem?
Then please describe the conflict you are getting, exact error message or exact behavior. Please include a screenshot if it would be illuminating.
Hi, I'm also seeing this with similar configuration to @commiyou. From the screenshot I can deduce @commiyou is using oh-my-zsh to load plugins (so am I).
I have only observed a conflict with zsh-autosuggestions so far.
My .zshrc (with oh-my-zsh installed) is:
plugins=(zsh-vim-mode zsh-syntax-highlighting zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
After reading this I was inclined to put zsh-autosuggestions
after zsh-syntax-highlighting
, but I don't think it should affect anything.
My repro is:
- type a command with multiple words
- after the first word and spacebar is pressed, autosuggestion remains but dark grey highlighting reverts to default color (white)
I also discovered a workaround, it seems this autosuggestion highlighting issue doesn't happen if I load zsh-vim-mode
after the other two plugins like:
plugins=(zsh-syntax-highlighting zsh-autosuggestions zsh-vim-mode)
I have also noticed that the highlighting on history-search-multi-word
plugin is now gone as well.
same as me
how to solve these conflicts?
I'm sorry for the long delay on fixing this. It looks like it is a conflict between the newish (zsh 5.3) add-zle-hook-widget
that I'm using, vs. the old method of modifying ${widgets}
directly. I've narrowed it down to the line add-zle-hook-widget line-pre-redraw vim-mode-line-pre-redraw
. If that's removed, the conflicts go away (and all of vim-mode's tracking of the input mode is gone, of course).
But even setting that hook to vim-mode-line-pre-redraw () { true }
causes the problem. So it's not the content of the hook, but its existence, that causes the problem. The funny thing is, neither zsh-autosuggestions nor zsh-syntax-highlighting mention redraw at all. So I have some more digging to do to find out how to work around this.
If you don't care about zsh-vim-mode's MODE_CURSOR_*
or MODE_INDICATOR_*
features, then commenting out line-pre-redraw
here is a quick workaround for now.
I should mention that ordering the plugins like this seems to work fully:
export ZSH=~/.oh-my-zsh
plugins=(
history-search-multi-word
zsh-autosuggestions
zsh-syntax-highlighting
zsh-vim-mode
)
source $ZSH/oh-my-zsh.sh
bindkey "^R" history-search-multi-word
I got the same requirement of loading sequence as above after trial and error. But when I enable another plugin adding line-finish
widget (before syntax-highlighting
) with add-zle-hook-widget
, the shell close at once after I press Enter
. It seems that both zsh-syntax-highlighting
and fast-syntax-highlighting
have problem dealing with the add-zle-hook-widget
method.
I guess we need to make sure all widgets enabled by add-zle-hook-widget
should be added after syntax-highlighting
?
Seems to be all resolved for me! Thanks.