I discovered once zsh-autosuggestions will bring up the first match you can scroll through history:
- scroll-up using ↑
- after first scrolling-up you can scroll-down using ↓
- accept the suggestion with →
Hi,I'm wondering which I should use between those two completion addons. I'm using zsh with ohmyzsh on macOs, in iterm2
zsh-autosuggestions is older and has way more stars, but seems to be less active these days
zsh-autocomplete is recent, and seems clearer in its README. Is it its successor?
Also if you know about fig... But fig asks to disable macOs secure terminal entry, which is a bummer
Thank you for your insights
ZSH autosuggestions: How to customize?
macos - How may I toggle the autosuggestion feature on/off in zsh? - Unix & Linux Stack Exchange
linux - How to change zsh-autosuggestions color - Stack Overflow
zsh autosuggestions
Videos
I discovered once zsh-autosuggestions will bring up the first match you can scroll through history:
- scroll-up using ↑
- after first scrolling-up you can scroll-down using ↓
- accept the suggestion with →
You can press the right button first, then use the keyboard up and down keys to switch, but did not find the ability to list
You can edit your ~/.zshrc and change/add the variable: ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=value'
I have just tested the value from fg=8 to fg=5. I think fg stands for Foreground.
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
**OBS: Add the above line at the end of your zshrc (after loading the plugin) **
I have found another reference here.
Here is a list of the color numbers: https://coderwall.com/p/pb1uzq/z-shell-colors
I settled on this one for solarized dark:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=60'
...and this one for solarized light:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=180'
I keep these in separate files (which do other color-theme manipulations) so that whenever somebody turns the lights on or off, I can just source the appropriate file, restart my terminal, and carry on.
My solution requires a little manual editing to make work, but you might find it interesting: https://github.com/MatrixManAtYrService/colorshift
If you also have zsh-syntax-highlighting enabled, there's a known conflict with older versions of zsh-autosuggestions. The GitHub issue reports versions:
zsh-autosuggestions: v0.6.4
zsh-syntax-highlighting: 0.8.0-alpha2-dev
The workaround is:
[...] was able to fix the issue by updating both autosuggestions and syntax-highlighting to their latest versions from GitHub [...]
To clone,
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Alternately, you could git fetch then git pull, assuming no merge conflicts.
Refer to the official documentation available on GitHub:
Set
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLEto configure the style that the suggestion is shown with. The default isfg=8, which will set the foreground color to color 8 from the 256-color palette. If your terminal only supports 8 colors, you will need to use a number between 0 and 7.Background color can also be set, and the suggestion can be styled bold, underlined, or standout. For example, this would show suggestions with bold, underlined, pink text on a cyan background:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"For more info, read the Character Highlighting section of the zsh manual:
man zshzleor online.Note: Some iTerm2 users have reported not being able to see the suggestions. If this affects you, the problem is likely caused by incorrect color settings. In order to correct this, go into iTerm2's setting, navigate to profile > colors and make sure that the colors for Basic Colors > Background and ANSI Colors > Bright Black are different.
So, you can change the colour of the suggestions and make them bold (maybe even underlined).
Modify the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE to:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#d787ff,bold'
It'll make it appear much brighter than before.
You might want to change it to some other colour, for example, Cyan:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#00ffff,bold'
You might like underlining the suggestion:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#00ffff,bold,underline'
For the colour chat refer to the colour palette.