mirror of
https://github.com/junegunn/fzf.git
synced 2024-08-17 10:20:26 +03:00
fix(zsh): use the '=~' operator instead of grep (#3906)
This commit is contained in:
parent
cfc149e994
commit
e1fcdbc337
@ -106,8 +106,8 @@ fi
|
|||||||
|
|
||||||
# CTRL-R - Paste the selected command from history into the command line
|
# CTRL-R - Paste the selected command from history into the command line
|
||||||
fzf-history-widget() {
|
fzf-history-widget() {
|
||||||
local selected num
|
local selected
|
||||||
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases noglob 2> /dev/null
|
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
|
# 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.
|
# 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
|
if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then
|
||||||
@ -122,8 +122,8 @@ fzf-history-widget() {
|
|||||||
fi
|
fi
|
||||||
local ret=$?
|
local ret=$?
|
||||||
if [ -n "$selected" ]; then
|
if [ -n "$selected" ]; then
|
||||||
if num=$(awk '{print $1; exit}' <<< "$selected" | grep -o '^[1-9][0-9]*'); then
|
if [[ $(awk '{print $1; exit}' <<< "$selected") =~ ^[1-9][0-9]* ]]; then
|
||||||
zle vi-fetch-history -n $num
|
zle vi-fetch-history -n $MATCH
|
||||||
else # selected is a custom query, not from history
|
else # selected is a custom query, not from history
|
||||||
LBUFFER="$selected"
|
LBUFFER="$selected"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user