From e7b287940f9097afff765480700dc6f54e097b2e Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 27 Sep 2024 11:00:16 +0200 Subject: [PATCH] zprofile:compat: Use a subshell for fzf_keys The `${(*)...}` parameter expansion flag was only introduced in zsh-5.8.1.2-test, but EXTENDED_GLOB is needed for the `(#m)` globbing flag. To support older zsh versions too, solve this by using a subshell in which EXTENDED_GLOB is temporarily enabled. --- .config/zsh/.zprofile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index eb34a92..1765ea7 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -144,7 +144,13 @@ typeset -A fzf_keys=( bspace track-current+backward-delete-char backward-eof untrack-current ) -FZF_DEFAULT_OPTS=" --bind ${(@*kj:,:)fzf_keys/(#m)*/$MATCH:$fzf_keys[$MATCH]}" +# NOTE: Use a subshell to temporarily enable EXTENDED_GLOB needed by the (#m) +# globbing flag, since the (*) parameter expansion flag was "only" introduced in +# zsh-5.8.1.2-test +FZF_DEFAULT_OPTS="$( + emulate -L zsh -o extendedglob + printf " --bind %s" "${(@kj:,:)fzf_keys/(#m)*/$MATCH:$fzf_keys[$MATCH]}" +)" unset fzf_keys FZF_DEFAULT_OPTS+=" --highlight-line"