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

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE #752

Closed
Aur0nd opened this issue Jul 20, 2023 · 6 comments
Closed

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE #752

Aur0nd opened this issue Jul 20, 2023 · 6 comments
Labels

Comments

@Aur0nd
Copy link

Aur0nd commented Jul 20, 2023

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

@Aur0nd Aur0nd added the bug label Jul 20, 2023
@Goncharo
Copy link

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

Screenshot 2023-07-22 at 10 00 41 AM

@hectorhuertas
Copy link

Also happens on Arch

@Hacksore
Copy link

Hacksore commented Sep 2, 2023

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
Copy link

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

@ivanjermakov
Copy link

ivanjermakov commented Feb 2, 2024

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

@Aur0nd Aur0nd closed this as completed May 17, 2024
@patrick96
Copy link

patrick96 commented May 21, 2024

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

patrick96 added a commit to patrick96/zsh-autosuggestions that referenced this issue May 21, 2024
If ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE was something like `fg=7`, when
adding it to `region_highlight`, it would be replaced with `fg=white`
implicitly.
This means that the entry is not removed in
_zsh_autosuggest_highlight_reset and the suggestion highlighting
remains.

This uses the ZSH 5.9 `memo` feature which allows us to tag entries in
region_highlight and remove entry by tag instead of by exact contents.

Fixes zsh-users#752
Ref: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants