]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/percol/percol.plugin.zsh
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / percol / percol.plugin.zsh
1 (( ${+commands[percol]} )) || return
2
3 function percol_select_history() {
4   # print history in reverse order (from -1 (latest) to 1 (oldest))
5   BUFFER=$(fc -l -n -1 1 | percol --query "$LBUFFER")
6   CURSOR=$#BUFFER
7   zle -R -c
8 }
9 zle -N percol_select_history
10 bindkey -M emacs '^R' percol_select_history
11 bindkey -M viins '^R' percol_select_history
12 bindkey -M vicmd '^R' percol_select_history
13
14 if (( ${+functions[marks]} )); then
15   function percol_select_marks() {
16     # parse directory from marks output (markname -> path) and quote if necessary
17     BUFFER=${(q)"$(marks | percol --query "$LBUFFER")"##*-> }
18     CURSOR=$#BUFFER
19     zle -R -c
20   }
21   zle -N percol_select_marks
22   bindkey -M emacs '^B' percol_select_marks
23   bindkey -M viins '^B' percol_select_marks
24   bindkey -M vicmd '^B' percol_select_marks
25 fi