From 5e4487ed4a04c6559d4cc500e053c0b0d5a1d4af Mon Sep 17 00:00:00 2001 From: Isaac W Hanson Date: Fri, 18 Aug 2017 16:00:42 -0400 Subject: [PATCH] escape pattern-matching chars on $prefix for match_prev_cmd strategy --- src/strategies/match_prev_cmd.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index ee26346..5693098 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -26,7 +26,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)$prefix*]}) + history_match_keys=(${(k)history[(R)${(b)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}" diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 9ea5960..5391c2b 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -533,7 +533,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)$prefix*]}) + history_match_keys=(${(k)history[(R)${(b)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}"