2016-02-05 23:14:08 +01:00
|
|
|
|
2016-02-14 08:29:43 +01:00
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# Start #
|
|
|
|
#--------------------------------------------------------------------#
|
2016-02-05 23:14:08 +01:00
|
|
|
|
|
|
|
# Start the autosuggestion widgets
|
2016-02-07 22:21:57 +01:00
|
|
|
_zsh_autosuggest_start() {
|
2019-04-10 19:41:20 +02:00
|
|
|
# By default we re-bind widgets on every precmd to ensure we wrap other
|
|
|
|
# wrappers. Specifically, highlighting breaks if our widgets are wrapped by
|
|
|
|
# zsh-syntax-highlighting widgets. This also allows modifications to the
|
|
|
|
# widget list variables to take effect on the next precmd. However this has
|
|
|
|
# a decent performance hit, so users can set ZSH_AUTOSUGGEST_MANUAL_REBIND
|
|
|
|
# to disable the automatic re-binding.
|
|
|
|
if (( ${+ZSH_AUTOSUGGEST_MANUAL_REBIND} )); then
|
|
|
|
add-zsh-hook -d precmd _zsh_autosuggest_start
|
|
|
|
fi
|
2017-02-18 18:47:53 +01:00
|
|
|
|
2016-02-05 23:14:08 +01:00
|
|
|
_zsh_autosuggest_bind_widgets
|
|
|
|
}
|
2016-02-07 22:21:57 +01:00
|
|
|
|
2020-01-27 05:15:47 +01:00
|
|
|
# Mark for auto-loading the functions that we use
|
|
|
|
autoload -Uz add-zsh-hook is-at-least
|
|
|
|
|
2020-01-27 05:18:01 +01:00
|
|
|
# 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
|
|
|
|
|
2017-01-27 23:18:26 +01:00
|
|
|
# Start the autosuggestion widgets on the next precmd
|
2016-02-07 22:21:57 +01:00
|
|
|
add-zsh-hook precmd _zsh_autosuggest_start
|