36,193
stars
+2
1,936
forks
180
watchers
230
prs
627
issues
0
releases
0
discussions
README
zsh-autosuggestions _Fish-like fast/unobtrusive autosuggestions for zsh._ It suggests commands as you type based on history and completions. Requirements: Zsh v4.3.11 or later Installation See INSTALL.md. Usage As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable. See configuration. If you press the → key (forward-char widget) or End (end-of-line widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion. If you invoke the forward-word widget, it will partially accept the suggestion up to the point that the cursor moves to. Configuration You may want to override the default global config variables. Default values of these variables can be found here. Note: If you are using Oh My Zsh, you can put this configuration in a file in the $ZSH_CUSTOM directory. See their comments on overriding internals. Suggestion Highlight Style Set ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE to configure the style that the suggestion is shown with. The default is fg=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: sh ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=ff00ff,bg=cyan,bold,underline" For more info, read the Character Highlighting section of the zsh manual: man zshzle or 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. Suggestion Strategy ZSH_AUTOSUGGEST_STRATEGY is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from: - history: Chooses the most recent match from history. - completion: Chooses a suggestion based on what tab-completion would suggest. (requires zpty module, which is included with zsh since 4.0.1) - match_prev_cmd: Like history, but chooses the most recent match whose preceding history item matches the most recently executed command (more info). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as HIST_IGNORE_ALL_DUPS or HIST_EXPIRE_DUPS_FIRST. For example, setting ZSH_AUTOSUGGEST_STRATEGY=(history completion) will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion
Top issues
#351Suggestions not cleared after paste when using bracketed-paste-magic30 comments · 2018-07-01#782An error occurred during the signature verification.27 comments · 2024-03-11#570zsh-autosuggestions misbehaving26 comments · 2020-10-27#538The color of the automatic prompt is incorrect.23 comments · 2020-05-26#698Highlight style is not cleared on accept when manually set to a value <817 comments · 2022-07-21#560Ubuntu 20.4 terminal the suggestion text color is the same as terminal tex13 comments · 2020-08-16#483Conflict with `zsh-users/zsh-syntax-highlighting`13 comments · 2019-12-02#363Autosuggest eats buffer by ctrl+w13 comments · 2018-07-30