Skip to content

Commit 297cd43

Browse files
committed
history: order deduplicated history latest-first
Rather than earliest first. Appears to address #71 more hollistically. I don't understand the internals of filter-select for a full root cause analysis here, but hey, it Works On My Machine™.
1 parent 98c3682 commit 297cd43

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sources/history.zsh

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ zmodload zsh/parameter
33
function zaw-src-history() {
44
if zstyle -t ':filter-select' hist-find-no-dups ; then
55
candidates=(${(@vu)history})
6+
options=("-m" "-s" "${BUFFER}")
67
else
78
cands_assoc=("${(@kv)history}")
9+
# have filter-select reverse the order (back to latest command first).
10+
# somehow, `cands_assoc` gets reversed while `candidates` doesn't.
11+
options=("-r" "-m" "-s" "${BUFFER}")
812
fi
913
actions=("zaw-callback-execute" "zaw-callback-replace-buffer" "zaw-callback-append-to-buffer")
1014
act_descriptions=("execute" "replace edit buffer" "append to edit buffer")
11-
options=("-r" "-m" "-s" "${BUFFER}")
1215

1316
if (( $+functions[zaw-bookmark-add] )); then
1417
# zaw-src-bookmark is available

0 commit comments

Comments
 (0)