Make $key in match_prev_cmd local

This commit is contained in:
druckdev 2021-07-14 16:56:00 +02:00
parent fcca87555f
commit afee79ef5b
No known key found for this signature in database
GPG Key ID: CA6B3A516FAC2555
2 changed files with 2 additions and 0 deletions

View File

@ -49,6 +49,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
# Iterate up to the first 200 history event numbers that match $prefix
local key
for key in "${(@)history_match_keys[1,200]}"; do
# Stop if we ran out of history
[[ $key -gt 1 ]] || break

View File

@ -711,6 +711,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
# Iterate up to the first 200 history event numbers that match $prefix
local key
for key in "${(@)history_match_keys[1,200]}"; do
# Stop if we ran out of history
[[ $key -gt 1 ]] || break