diff --git a/src/strategies/default.zsh b/src/strategies/default.zsh index 42da24e..29333f5 100644 --- a/src/strategies/default.zsh +++ b/src/strategies/default.zsh @@ -7,12 +7,5 @@ # _zsh_autosuggest_strategy_default() { - local prefix="$1" - - # Get the keys of the history items that match - local -a histkeys - histkeys=(${(k)history[(r)$prefix*]}) - - # Echo the value of the first key - echo -E "${history[$histkeys[1]]}" + fc -lnrm "$1*" 1 2>/dev/null | head -n 1 } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index d2c7d2c..9f25514 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -371,14 +371,7 @@ _zsh_autosuggest_escape_command() { # _zsh_autosuggest_strategy_default() { - local prefix="$1" - - # Get the keys of the history items that match - local -a histkeys - histkeys=(${(k)history[(r)$prefix*]}) - - # Echo the value of the first key - echo -E "${history[$histkeys[1]]}" + fc -lnrm "$1*" 1 2>/dev/null | head -n 1 } #--------------------------------------------------------------------#