Fix #164: Use fc builtin instead of $history array for lookup
According to a few tests, the `fc` builtin appears to be quite a bit faster than searching through the `$history` associative array when dealing with large history files (500K+).
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user