Add zsh anything.el plugin
[zsh.git] / .zsh / zaw / sources / history.zsh
1 zmodload zsh/parameter
2
3 function zaw-src-history() {
4 if zstyle -t ':filter-select' hist-find-no-dups ; then
5 candidates=(${(@vu)history})
6 options=("-m" "-s" "${BUFFER}")
7 else
8 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}")
12 fi
13 actions=("zaw-callback-execute" "zaw-callback-replace-buffer" "zaw-callback-append-to-buffer")
14 act_descriptions=("execute" "replace edit buffer" "append to edit buffer")
15
16 if (( $+functions[zaw-bookmark-add] )); then
17 # zaw-src-bookmark is available
18 actions+="zaw-bookmark-add"
19 act_descriptions+="bookmark this command line"
20 fi
21 }
22
23 zaw-register-src -n history zaw-src-history