summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
author林千里 <lincheney@gmail.com>2024-06-24 18:07:55 +1000
committerGitHub <noreply@github.com>2024-06-24 17:07:55 +0900
commite9e0011f1d319629337f3b1837056bc36c6a1f87 (patch)
treeee1cdaf71969775f69dae9df755831d89c6f5084 /shell
parent5b5283378571cca88a993630db3307319d2cb56d (diff)
downloadfzf-e9e0011f1d319629337f3b1837056bc36c6a1f87.tar.gz
fix zsh ${(@)history} syntax does not work with ksh_arrays (#3893)
When `setopt ksh_arrays` in zsh, `${(@kv)history}` gives only the first entry rather than all.
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 b6f0b376..f59fbae4 100644
--- a/shell/key-bindings.zsh
+++ b/shell/key-bindings.zsh
@@ -111,7 +111,7 @@ fzf-history-widget() {
# Ensure the associative history array, which maps event numbers to the full
# history lines, is loaded, and that Perl is installed for multi-line output.
if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then
- selected="$(printf '%s\t%s\000' "${(@kv)history}" |
+ selected="$(printf '%s\t%s\000' "${(kv)history[@]}" |
perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\t(.*)/s, $1)}++) { s/\n/\n\t/g; print; }' |
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"