Skip to content

Commit

Permalink
fix zsh ${(@)history} syntax does not work with ksh_arrays
Browse files Browse the repository at this point in the history
When `setopt ksh_arrays` in zsh, `${(@KV)history}` gives only the first entry rather than all.
  • Loading branch information
lincheney authored Jun 24, 2024
1 parent 1525768 commit 54967d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shell/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
Expand Down

0 comments on commit 54967d8

Please sign in to comment.