zsh-autosuggestions/src/strategies/default.zsh

16 lines
498 B
Bash
Raw Normal View History

#--------------------------------------------------------------------#
# Default Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.
#
_zsh_autosuggest_strategy_default() {
local prefix="$1"
2017-02-17 10:18:03 +08:00
# Get the history items that match
# - (r) subscript flag makes the pattern match on values
typeset -g suggestion="${history[(r)${(b)prefix}*]}"
}