diff options
| author | LangLangBart <92653266+LangLangBart@users.noreply.github.com> | 2024-07-03 04:03:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-03 11:03:21 +0900 |
| commit | e1fcdbc3372087d80ebfd30c3c433881b9535b38 (patch) | |
| tree | 21772a3854736bdf35e74712842da4b88e42f6d0 /shell | |
| parent | cfc149e99448c68f0d298fd8f99808cd2c36788e (diff) | |
| download | fzf-e1fcdbc3372087d80ebfd30c3c433881b9535b38.tar.gz | |
fix(zsh): use the '=~' operator instead of grep (#3906)
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/key-bindings.zsh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index f59fbae4..1490595d 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -106,8 +106,8 @@ fi # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { - local selected num - setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases noglob 2> /dev/null + local selected + setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases noglob nobash_rematch 2> /dev/null # Ensure the associative history array, which maps event numbers to the full # history lines, is loaded, and that Perl is installed for multi-line output. if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then @@ -122,8 +122,8 @@ fzf-history-widget() { fi local ret=$? if [ -n "$selected" ]; then - if num=$(awk '{print $1; exit}' <<< "$selected" | grep -o '^[1-9][0-9]*'); then - zle vi-fetch-history -n $num + if [[ $(awk '{print $1; exit}' <<< "$selected") =~ ^[1-9][0-9]* ]]; then + zle vi-fetch-history -n $MATCH else # selected is a custom query, not from history LBUFFER="$selected" fi |
