zsh-vi-mode
zsh-vi-mode copied to clipboard
Interference between zsh-vi-mode and zsh-syntax-highlighting
General information
Please report the following information as possible as you can:
- Terminal program: gnome-terminal 3.42.1
- Operating system: Solus Linux
- ZSH framework: zplug
- ZSH version: 5.8.0
- ZVM version: master
Basic examination
- [x] I have read through the README page
- [x] I have the latest version of zsh-vi-mode
- [x] I have tested with another terminal program
Problem description
zsh-vi-mode
seems to alter the behavior of zsh-syntax-highlighting
, and its impact depends on whether zsh-vi-mode
is sourced before or after zsh-syntax-highlighting
.
Reproduction steps
Firstly, I tried only installing zsh-autosuggestions
and zsh-syntax-highlighting
, but not installing zsh-vi-mode
. I also customized the highlighting rule for shell aliases. My mininum zshrc
file is as follows:
alias ls="ls --color=auto"
ZVM_INIT_MODE=sourcing
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
source $ZPLUG_HOME/init.zsh
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
#zplug "jeffreytse/zsh-vi-mode", defer:3
zplug load
ZSH_HIGHLIGHT_STYLES[alias]="fg=#88c0d0"
this is the behavior of the syntax highlight:
Now I first tried to source zsh-vi-mode
before zsh-syntax-highlighting
. My zshrc
file is as follows:
alias ls="ls --color=auto"
ZVM_INIT_MODE=sourcing
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
source $ZPLUG_HOME/init.zsh
zplug "jeffreytse/zsh-vi-mode"
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug load
ZSH_HIGHLIGHT_STYLES[alias]="fg=#88c0d0"
The behavior of syntax highlighting becomes
The problem is that, when I typed ls
, the test
is the suggestion and it is supposed to be in a dimmed color. However, it the gif, test
is highlighted as regular text instead of a dimmed color.
Then when I typed cd
, test
is in dimmed color. However, as soon as I typed the first letter in test
, the word test
becomes regular text color (white in my case). In the first gif, one can see that if we don't source zsh-vi-mode
, cd t
should still keep est
in dimmed color.
Then I tried source zsh-vi-mode
last. My zshrc
becomes
alias ls="ls --color=auto"
ZVM_INIT_MODE=sourcing
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
source $ZPLUG_HOME/init.zsh
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "jeffreytse/zsh-vi-mode", defer:3
zplug load
ZSH_HIGHLIGHT_STYLES[alias]="fg=#88c0d0"
Now the behavior of ls<Tab>
is shown below.
ls
is a shell alias and is supposed to be in color #88c0d0
(cyan). This is correct before I typed <Tab>
. However, when I typed <Tab>
, the color of ls
becomes some sort of pink color. This change of color with <Tab>
does not happen if I do not load zsh-vi-mode
at all.
Expected behavior
There should be a way to set up zsh-vi-mode
such that it does not interfere with zsh-syntax-highlighting
.
Hi @xulongwu4
Thanks for your issue, and sorry for the late reply, currently I'm quite busy, I will research your issue when I am possible. Hope you have a good day! : )
Thanks and Regards
Hello ! I have a similar issue ! I only have zsh-syntax-highlighting
and zsh-autosuggestions
(+ completions), using no plugin manager. Whenever I add zvm to the mix, no matter the position, no more syntax highlighting at all. ls --color=auto
works fine regardless though.
The same thing happens to me. Can't get either to work.
Same issue for me as well. Using omz to manage plugins.
I love the plugin btw! Thanks for that. The syntax highlighting is not too important, but I do feel like I'm missing it though. Maybe you could guide us into the right direction of where to look for a solution? I understand you are busy.
Update: I installed this plugin instead https://github.com/zdharma-continuum/fast-syntax-highlighting and that seems to work.
Cheers
Replaced zsh-syntax-highlighting
with fast-syntax-highlighting
to fix the interference with syntax highlighting!
Replaced
zsh-syntax-highlighting
withfast-syntax-highlighting
to fix the interference with syntax highlighting!
Thanks, that seems to work. For me at least.
I've also encountered this issue with the combination of zsh-vi-mode
and zsh-syntax-highlighting
& zsh-autosuggestions
.
Looks like what I'd expect before the command name has been written:
But once the command name is written the suggestion is not styled as expected:
Is this issue still on the radar? Are there any hunches about where the problem might be originating from?
Update: I installed this plugin instead https://github.com/zdharma-continuum/fast-syntax-highlighting and that seems to work.
Can confirm this worked for me as well
Any update on this? I'd rather continue using zsh-syntax-highlighting
because my custom theme depends on it. Thanks for the plugin.
Hi @ryanmsnyder,
I'd love to have a check on this issue, as I'm quite busy recently, please be patient, I'll try to fix it as soon as possible.
Thanks & Regards
Hi @xulongwu4
If your issue has been settled down with the HEAD version, let's close this issue.
Thanks & Regards