Patch-Source: https://github.com/junegunn/fzf/pull/2777 -- From 2010527ed671901e908f0a2b3b7dc64971810945 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sat, 2 Apr 2022 00:34:27 +0200 Subject: [PATCH] [zsh] Replace perl with awk Unlike awk, which is even defined in POSIX, perl is not pre-installed on all *nix systems. This awk command is functionally equivalent to the original perl command. --- shell/key-bindings.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index 032cd439f..f3df56f88 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -97,7 +97,7 @@ bindkey -M viins '\ec' fzf-cd-widget fzf-history-widget() { local selected num setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null - selected=( $(fc -rl 1 | perl -ne 'print if !$seen{(/^\s*[0-9]+\**\s+(.*)/, $1)}++' | + selected=( $(fc -rl 1 | awk '{ line=$0; $1=""; if (!seen[$0]++) print line }' | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) local ret=$? if [ -n "$selected" ]; then