aports/community/skim/replace-perl-with-awk.patch

42 lines
1.7 KiB
Diff

Patch-Source: https://github.com/lotabout/skim/pull/449
--
From d645ccbcccea79473d96439d1db4d5378c012195 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sat, 2 Apr 2022 00:29:30 +0200
Subject: [PATCH] [shell] replace perl with awk in key-bindings.zsh
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 ac99db2..700ae9a 100644
--- a/shell/key-bindings.zsh
+++ b/shell/key-bindings.zsh
@@ -118,7 +118,7 @@ bindkey '\ec' skim-cd-widget
skim-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 }' |
SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} --no-multi" $(__skimcmd)) )
local ret=$?
if [ -n "$selected" ]; then
From b185f58f0e87bc234e687e4a13e12431bb9ff476 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sat, 2 Apr 2022 01:52:49 +0200
Subject: [PATCH 2/2] [shell] include date or time in Zsh history if available
If extended_history is enabled, the history widget will display:
12 2022-04-02 echo "older command"
123 today'16:30 echo "today's command"
---
shell/key-bindings.zsh | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)