From: PHO Date: Wed, 11 Sep 2013 08:19:55 +0000 (+0900) Subject: Auto commit by The Sugar System. X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=sugar.git;a=commitdiff_plain;h=4003f6c2eee6215e6f77d8d11d17d2ef60461056 Auto commit by The Sugar System. --- 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