diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2018-07-11 10:39:25 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2018-07-11 10:39:25 -0700 |
commit | 852e7fe005267f74f3c04a4ddbb310522eee8014 (patch) | |
tree | 73e9f36d8bdcc979d7499580505738074e5a1dc9 /plugins/percol/percol.plugin.zsh | |
parent | 59e91cd97fcc3c406751f019215f957b36614022 (diff) | |
parent | 7cb5fa8aea3d325fee08e3c1708abd12cdea1c1c (diff) | |
download | zsh-852e7fe005267f74f3c04a4ddbb310522eee8014.tar.gz zsh-852e7fe005267f74f3c04a4ddbb310522eee8014.tar.bz2 zsh-852e7fe005267f74f3c04a4ddbb310522eee8014.zip |
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/percol/percol.plugin.zsh')
-rw-r--r-- | plugins/percol/percol.plugin.zsh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/percol/percol.plugin.zsh b/plugins/percol/percol.plugin.zsh new file mode 100644 index 000000000..c6adf4e1e --- /dev/null +++ b/plugins/percol/percol.plugin.zsh @@ -0,0 +1,22 @@ +if which percol &> /dev/null; then + function percol_select_history() { + local tac + which gtac &> /dev/null && tac="gtac" || { which tac &> /dev/null && tac="tac" || { tac="tail -r" } } + BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") + CURSOR=$#BUFFER + zle -R -c + } + + zle -N percol_select_history + bindkey '^R' percol_select_history + + if which marks &> /dev/null; then + function percol_select_marks() { + BUFFER=$(marks | percol --query "$LBUFFER" | awk '{print $3}') + CURSOR=$#BUFFER # move cursor + zle -R -c # refresh + } + zle -N percol_select_marks + bindkey '^B' percol_select_marks + fi +fi |