diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-05-02 15:11:16 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-05-02 15:11:16 +0800 |
commit | 1dc93cc76a88d8f0aba6c625858c49889d838b5c (patch) | |
tree | 3ebc452a38f69befc9ab36b8e672c02ca6aa92ed /_zsh | |
parent | 1570088c67b60712cacef96f4aeb487a40e403c9 (diff) | |
download | dotfiles-1dc93cc76a88d8f0aba6c625858c49889d838b5c.tar.bz2 |
_zsh: reorder history.zsh; intergrate "percol"
Diffstat (limited to '_zsh')
-rw-r--r-- | _zsh/40-history.zsh | 12 | ||||
-rw-r--r-- | _zsh/50-history.zsh | 30 |
2 files changed, 30 insertions, 12 deletions
diff --git a/_zsh/40-history.zsh b/_zsh/40-history.zsh deleted file mode 100644 index e1275a6..0000000 --- a/_zsh/40-history.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# -# zsh/history.zsh -# - -HISTFILE=~/.zsh_history - -HISTSIZE=10000 -SAVEHIST=9000 -# ignore these commands without arguments -HISTIGNORE="cd:ls:ll" - -# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # diff --git a/_zsh/50-history.zsh b/_zsh/50-history.zsh new file mode 100644 index 0000000..8b15561 --- /dev/null +++ b/_zsh/50-history.zsh @@ -0,0 +1,30 @@ +# +# zsh/history.zsh +# + +HISTFILE=~/.zsh_history + +HISTSIZE=10000 +SAVEHIST=9000 +# ignore these commands without arguments +HISTIGNORE="cd:ls:ll" + + +# Combine history search with `percol` +# Credit: https://github.com/mooz/percol +if exists percol; then + function percol_select_history() { + local tac + exists gtac && tac="gtac" || { + exists tac && tac="tac" || { + tac="tail -r" } } + BUFFER=$(fc -l -n 1 | eval ${tac} | percol --query "${LBUFFER}") + CURSOR=${#BUFFER} # move cursor + zle -R -c # refresh + } + + zle -N percol_select_history + bindkey '^R' percol_select_history +fi + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: # |