Enable async mode by default in newer versions of zsh

Allow users to override the default by unsetting (or setting) the
ZSH_AUTOSUGGEST_USE_ASYNC variable.

See GitHub issue #498.
This commit is contained in:
Eric Freese
2020-01-26 21:18:01 -07:00
parent 19e375bbc8
commit 6c634c1e35
4 changed files with 20 additions and 9 deletions

View File

@@ -21,5 +21,13 @@ _zsh_autosuggest_start() {
# Mark for auto-loading the functions that we use
autoload -Uz add-zsh-hook is-at-least
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
# older versions because there is a bug when using async mode where ^C does not
# work immediately after fetching a suggestion.
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
if is-at-least 5.0.8; then
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
fi
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start