zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
30.3k stars 1.85k forks source link

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE #752

Closed Aur0nd closed 1 month ago

Aur0nd commented 11 months ago

Describe the bug

let's assume that we want to type ls -lha ~/Desktop if I type the whole command then everything works as expected, but if I type "ls -lh" and then accept the suggestion, everything after "ls -lh" is going to have the suggestions color (Greyed out or whatever color I choose).

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=4'
Screenshot 2023-07-20 at 14 42 58

Desktop

MacOS Sonoma

Goncharo commented 11 months ago

Yup same thing here, if anyone has a workaround that'd be great

Screenshot 2023-07-22 at 10 00 41 AM
hectorhuertas commented 10 months ago

Also happens on Arch

Hacksore commented 10 months ago

I have this set in my .zshrc:

export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=8"

This is what happens to me in neovim+tmux: image

This is what happens when using only tmux image

I'm not sure if this issue is related but it's really hard to use the plugin 😢.

alifhughes commented 10 months ago

setting export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#f1d687" in my ~/.zshrc worked for me, it is a similar colour to the default.

ivanjermakov commented 5 months ago

I had the same problem with

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#aaa"

image It works with full color hex

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#aaaaaa"

image

patrick96 commented 1 month ago

Problem seems to be that when fg=7 (or anything below 8, at least in my terminal) is added to region_highlight (which is doing the highlighting), it is implicitly replaced by the color name. When undoing the highlighting, this plugin searches for fg=7 exactly to replace it, which then fails.

It's likely more robust to use the memo property for this. EDIT: memo seems to be a ZSH 5.9 feature (the latest version at the time of writing), so not sure whether it makes sense to bump the version requirement to 5.9 for this