Default strategy now tries history first and falls back to completion

This commit is contained in:
Eric Freese
2018-05-16 15:52:46 -06:00
parent 82b08e2dc8
commit c5551daabc
3 changed files with 50 additions and 16 deletions

View File

@@ -631,11 +631,28 @@ _zsh_autosuggest_strategy_completion() {
#--------------------------------------------------------------------#
# Default Suggestion Strategy #
#--------------------------------------------------------------------#
# Will provide suggestions from your history. If no matches are found
# in history, will provide a suggestion from the completion engine.
#
_zsh_autosuggest_strategy_default() {
typeset -g suggestion
_zsh_autosuggest_strategy_history "$1"
if [[ -z "$suggestion" ]]; then
_zsh_autosuggest_strategy_completion "$1"
fi
}
#--------------------------------------------------------------------#
# History Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.
#
_zsh_autosuggest_strategy_default() {
_zsh_autosuggest_strategy_history() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh