Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interference between zsh-vi-mode and zsh-syntax-highlighting #154

Open
3 tasks done
xulongwu4 opened this issue Dec 26, 2021 · 11 comments
Open
3 tasks done

Interference between zsh-vi-mode and zsh-syntax-highlighting #154

xulongwu4 opened this issue Dec 26, 2021 · 11 comments
Assignees
Labels
bug Something isn't working verified This issue was already verified

Comments

@xulongwu4
Copy link

xulongwu4 commented Dec 26, 2021

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

  • I have read through the README page
  • I have the latest version of zsh-vi-mode
  • 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:

Peek 2021-12-26 17-49

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
vi_first

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.
vi_last

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.

@jeffreytse
Copy link
Owner

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

@jeffreytse jeffreytse self-assigned this Jan 16, 2022
@jeffreytse jeffreytse added the bug Something isn't working label Jan 16, 2022
@ghost
Copy link

ghost commented Feb 14, 2022

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.

@luisbc92
Copy link

The same thing happens to me. Can't get either to work.

@mattiasbonte
Copy link

mattiasbonte commented Jul 8, 2022

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

@sidoverflow
Copy link

Replaced zsh-syntax-highlighting with fast-syntax-highlighting to fix the interference with syntax highlighting!

@Schievel1
Copy link

Replaced zsh-syntax-highlighting with fast-syntax-highlighting to fix the interference with syntax highlighting!

Thanks, that seems to work. For me at least.

@erikkrieg
Copy link

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:
Screen Shot 2023-05-07 at 9 57 55 AM

But once the command name is written the suggestion is not styled as expected:
Screen Shot 2023-05-07 at 9 58 06 AM

Is this issue still on the radar? Are there any hunches about where the problem might be originating from?

@rafaVls
Copy link

rafaVls commented Jun 4, 2023

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

@ryanmsnyder
Copy link

Any update on this? I'd rather continue using zsh-syntax-highlighting because my custom theme depends on it. Thanks for the plugin.

@jeffreytse
Copy link
Owner

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

@jeffreytse jeffreytse added the verified This issue was already verified label Jul 9, 2023
jeffreytse added a commit that referenced this issue Jul 9, 2023
This issue was caused by a bug which didn't invoke original function
after hooking the function. This bug also caused issues mentioned in
the #154 as well.
@jeffreytse
Copy link
Owner

Hi @xulongwu4

If your issue has been settled down with the HEAD version, let's close this issue.

Thanks & Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified This issue was already verified
Projects
None yet
Development

No branches or pull requests

9 participants