1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-06 15:30:40 +01:00

add plugin:percol (#4582)

* add plugin:percol

* fix format

* check percol

* fix empty history in gnome terminal
This commit is contained in:
当轩
2018-07-02 05:07:35 +08:00
committed by Marc Cornellà
parent 55ab532e50
commit ac0d71467b
2 changed files with 45 additions and 0 deletions

View File

@@ -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