X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=dot-files%2F_zshrc;h=49c5ad2edea2b88b10344362bcd1e837eb60f1cb;hb=4003f6c2eee6215e6f77d8d11d17d2ef60461056;hp=603cdd2d925539ea4c0fe16dc3fb28914e5e419c;hpb=3eb4aafeb49218e0a6d051d4b16e25b561d1b84b;p=sugar.git diff --git a/dot-files/_zshrc b/dot-files/_zshrc index 603cdd2..49c5ad2 100644 --- a/dot-files/_zshrc +++ b/dot-files/_zshrc @@ -159,14 +159,17 @@ function percol_select_history() { tac_cmd=("cat") fi - BUFFER=$("${tac_cmd[@]}" "$HISTFILE" | \ + local selected + selected=$("${tac_cmd[@]}" "$HISTFILE" | \ sed 's/^: [0-9]*:[0-9]*;//' | \ percol --match-method regex --query "$LBUFFER") - CURSOR=$#BUFFER # move cursor to the end of line - zle redisplay - - if [[ -n $BUFFER ]]; then + if [[ $? -eq 0 ]]; then + BUFFER="$selected" + CURSOR="$#BUFFER" # move cursor to the end of line + zle redisplay zle accept-line + else + zle redisplay fi } if which percol >&/dev/null; then