From 59f4f483956eb5318d4e1a4d45aa242948daab8a Mon Sep 17 00:00:00 2001 From: peccu Date: Sun, 24 Aug 2025 06:49:50 +0900 Subject: [PATCH] [shell] make awk regex compatible with macOS default awk (#845) Unlike GNU awk (gawk), the default awk on macOS does not support \s, making the previous expression not truly equivalent to the original perl command. This change replaces the entire first column with an empty string, achieving the same substitution effect in a portable way. refs https://github.com/junegunn/fzf/pull/2906 --- 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 32b1625c..8c2dbf3a 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -133,7 +133,7 @@ bindkey '\ec' skim-cd-widget skim-history-widget() { local selected num setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null - local awk_filter='{ cmd=$0; sub(/^\s*[0-9]+\**\s+/, "", cmd); if (!seen[cmd]++) print $0 }' # filter out duplicates + local awk_filter='{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' # filter out duplicates local n=2 fc_opts='' if [[ -o extended_history ]]; then local today=$(date +%Y-%m-%d)