fix zsh ${(@)history} syntax does not work with ksh_arrays #3893
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
setopt ksh_arrays
in zsh,${(@kv)history}
gives only the first entry rather than all.This is breaking the zsh control-r history widget to show only the latest history entry rather than all (which isn't very useful).
I have
setopt ksh_arrays
set in my zshrc.I believe this is caused by https://github.com/junegunn/fzf/pull/3882/files#diff-c1d0c74baf2323d5dc27290b500868528b9a80be6a0844e998eefb2f9f6ab968R114
specifically the change from
${(kv)history[@]}
to${(@kv)history}
does not seem to work when you havesetopt ksh_arrays
(it gives back only the one latest history entry).This fixes it for me, but a potentially better fix could be to add something like
emulate -LR zsh
at the start of all widgets