From 4ea825faf893e2c596e630a926a9f83629ec7327 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 6 Dec 2017 08:09:14 -0700 Subject: [PATCH] Fix #247 and #248 without using `(b)` flag To support older versions of zsh (< 5.0.8). We were missing the EXTENDED_GLOB option that allows use of `(#m)` flag. --- src/strategies/match_prev_cmd.zsh | 6 ++++++ zsh-autosuggestions.zsh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index dfeb55f..f76d3c1 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -21,6 +21,12 @@ # `HIST_EXPIRE_DUPS_FIRST`. _zsh_autosuggest_strategy_match_prev_cmd() { + # Reset options to defaults and enable LOCAL_OPTIONS + emulate -L zsh + + # Enable globbing flags so that we can use (#m) + setopt EXTENDED_GLOB + # TODO: Use (b) flag when we can drop support for zsh older than v5.0.8 local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}" diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 95792da..ebc717d 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -528,6 +528,12 @@ _zsh_autosuggest_strategy_default() { # `HIST_EXPIRE_DUPS_FIRST`. _zsh_autosuggest_strategy_match_prev_cmd() { + # Reset options to defaults and enable LOCAL_OPTIONS + emulate -L zsh + + # Enable globbing flags so that we can use (#m) + setopt EXTENDED_GLOB + # TODO: Use (b) flag when we can drop support for zsh older than v5.0.8 local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"