

Suggestions are fetched asynchronously by default in zsh versions 5.0.8 and greater. This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long. The default is unset, which means that autosuggestion will be tried for any buffer size. Set ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to an integer value to disable autosuggestion for large buffers. Note: A widget shouldn't belong to more than one of the above arrays. Widgets that modify the buffer and are not found in any of these arrays will fetch a new suggestion after they are invoked. ZSH_AUTOSUGGEST_IGNORE_WIDGETS: Widgets in this array will not trigger any custom behavior.ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS: Widgets in this array will partially accept the suggestion when invoked.ZSH_AUTOSUGGEST_EXECUTE_WIDGETS: Widgets in this array will execute the suggestion when invoked.ZSH_AUTOSUGGEST_ACCEPT_WIDGETS: Widgets in this array will accept the suggestion when invoked.ZSH_AUTOSUGGEST_CLEAR_WIDGETS: Widgets in this array will clear the suggestion when invoked.

You can add and remove widgets from these arrays to change the behavior of this plugin: This plugin works by triggering custom behavior when certain zle widgets are invoked. 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.įor 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 from the completion engine.

See their comments on overriding internals. Note: If you are using Oh My Zsh, you can put this configuration in a file in the $ZSH_CUSTOM directory. Default values of these variables can be found here. You may want to override the default global config variables. If you invoke the forward-word widget, it will partially accept the suggestion up to the point that the cursor moves to. 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. This color can be changed by setting the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable. It suggests commands as you type based on history and completions.Īs you type commands, you will see a completion offered after the cursor in a muted gray color. Fish-like fast/unobtrusive autosuggestions for zsh.
