mattmc3 / antidote

https://getantidote.github.io - the cure to slow zsh plugin management
MIT License
862 stars 21 forks source link

Using ` kind:defer` to `zdharma-continuum/fast-syntax-highlighting` duplicates strings on `forward-word` with `zsh-users/zsh-autosuggestions` #199

Closed Akhil-CM closed 1 hour ago

Akhil-CM commented 2 hours ago

I add kind:defer to zdharma-continuum/fast-syntax-highlighting with the following config:

# .zsh_plugins.txt file

# Completions.
zsh-users/zsh-completions path:src kind:fpath

mattmc3/ez-compinit

# Syntax highlighting
zdharma-continuum/fast-syntax-highlighting kind:defer

# These popular core plugins should be loaded at the end
zsh-users/zsh-autosuggestions

and enter the following in the terminal: ~$ echo one && echo two

the next time I type e in the terminal, there will be autosuggestions. Since I have the following in my .zshrc:

# Control Right arrow
bindkey "^[[1;5C" forward-word

# Control F
bindkey "^F" forward-word

I press the keybind for forward word and it will complete each forward from the autosuggestions. However, when I complete the autosuggestion for echo command above, I get after the last word: ~$ echo one && echo twotwo So the last word is duplicated (two -> twotwo)

This doesn't happen in two cases:

  1. have quotes at the end. So, if the echo command first executed was something like ~$ echo "one" && echo "two"
  2. If I remove kind:defer from zdharma-continuum/fast-syntax-highlighting in as follows:
    
    # .zsh_plugins.txt file

Completions.

zsh-users/zsh-completions path:src kind:fpath

mattmc3/ez-compinit

Syntax highlighting

zdharma-continuum/fast-syntax-highlighting

These popular core plugins should be loaded at the end

zsh-users/zsh-autosuggestions

mattmc3 commented 2 hours ago

Even though kind:defer has a special annotation in antidote, it's not code I wrote or maintain, so my support for any issues related to its use is very limited. Zsh-defer is actually just a regular Zsh plugin that lives here: romkatv/zsh-defer. It has some caveats you may want to go over, and some flags it accepts. If you need to set a flag for zsh-defer, you can do so with this zstyle:

zstyle ':antidote:bundle:*' defer-options '-a'
zstyle ':antidote:bundle:zdharma-continuum/fast-syntax-highlighting' defer-options '-s'

Beyond that, there's nothing specific to antidote that is happening here to cause this. It's something with the interactions between zdharma-continuum/fast-syntax-highlighting, romkatv/zsh-defer, and zsh-users/zsh-autosuggestions. Sorry I can't be of more help on this.

Akhil-CM commented 1 hour ago

That's completely fine. Just posting here so that anyone else with the issue can see this. For now, I have disabled defer as I don't notice any difference with and without it