zsh-autosuggestions/src/strategies/default.zsh

19 lines
528 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"
2016-03-06 05:03:14 +01:00
# Get the keys of the history items that match
local -a histkeys
histkeys=(${(k)history[(r)$prefix*]})
2016-03-06 05:03:14 +01:00
# Echo the value of the first key
echo -E "${history[$histkeys[1]]}"
}