zsh-autosuggestions/autosuggestions.zsh

31 lines
614 B
Bash
Raw Normal View History

2016-01-27 04:51:44 +01:00
#
# Fish-like autosuggestions for zsh
2013-10-26 20:05:12 +02:00
#
# ```zsh
# zle-line-init() {
2016-01-27 04:51:44 +01:00
# autosuggest_start
# }
# zle -N zle-line-init
2013-10-26 20:05:12 +02:00
# ```
2013-10-26 18:05:17 +02:00
2016-01-27 04:51:44 +01:00
unset _ZSH_AUTOSUGGESTION_ACTIVE
2016-01-27 04:51:44 +01:00
LIBDIR="${0:a:h}/lib"
2016-01-27 04:51:44 +01:00
source "$LIBDIR/config.zsh"
source "$LIBDIR/get_suggestion.zsh"
source "$LIBDIR/highlight.zsh"
source "$LIBDIR/widget/widgets.zsh"
source "$LIBDIR/widget/hook.zsh"
2016-01-27 04:51:44 +01:00
autosuggest_start() {
_ZSH_AUTOSUGGESTION_ACTIVE=true
2016-01-27 04:51:44 +01:00
# Register highlighter if needed to support zsh-syntax-highlighting plugin
if _zsh_autosuggest_syntax_highlighting_enabled; then
_zsh_autosuggest_register_highlighter
fi
2016-01-27 04:51:44 +01:00
_zsh_autosuggest_hook_widgets
}