summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2022-07-20 04:53:34 +0200
committerGitHub <noreply@github.com>2022-07-20 11:53:34 +0900
commit8df872a482799377fc03c3ef58f408484bf6b7bf (patch)
tree68b01e2c280defad0ad966ba56d35f588adfaa7d /shell
parentc79c306adb40b50756481e1667fcf523de07a7b3 (diff)
[zsh] Replace perl with awk (#2777)
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.
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.zsh2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh
index fe219bf4..88a9a9e7 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 '{ cmd=$0; sub(/^\s*[0-9]+\**\s+/, "", cmd); if (!seen[cmd]++) print $0 }' |
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