あえて peco じゃなくて percol 使う。
インストール
$ sudo pip install percol
755 にしろと言われる
動くか試す
$ percol /var/log/syslog $ ps aux | percol
.zshrc に設定追加
ヒストリーは公式ママ
最近使ったディレクトリは下記リンク
function exists { which $1 &> /dev/null } if exists percol; then # history 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 # cdr autoload -Uz chpwd_recent_dirs cdr add-zsh-hook add-zsh-hook chpwd chpwd_recent_dirs zstyle ':chpwd:*' recent-dirs-max 500 # cdrの履歴を保存する個数 zstyle ':chpwd:*' recent-dirs-default yes zstyle ':completion:*' recent-dirs-insert both # http://shibayu36.hatenablog.com/entry/2013/10/07/185048 function percol-cdr () { local selected_dir=$(cdr -l | awk '{ print $2 }' | percol --query "$LBUFFER") if [ -n "$selected_dir" ]; then BUFFER="cd ${selected_dir}" zle accept-line fi zle clear-screen } zle -N percol-cdr bindkey '^]' percol-cdr fi
Configuration
更新の設定をプロンプトだけ変更してみた
~/.percol.d/rc.py
percol.view.PROMPT = ur"<cyan>>>> </cyan> %q" # noqa # Emacs like percol.import_keymap({ # noqa "C-h": lambda percol: percol.command.delete_backward_char(), "C-d": lambda percol: percol.command.delete_forward_char(), "C-k": lambda percol: percol.command.kill_end_of_line(), "C-y": lambda percol: percol.command.yank(), "C-t": lambda percol: percol.command.transpose_chars(), "C-a": lambda percol: percol.command.beginning_of_line(), "C-e": lambda percol: percol.command.end_of_line(), "C-b": lambda percol: percol.command.backward_char(), "C-f": lambda percol: percol.command.forward_char(), "M-f": lambda percol: percol.command.forward_word(), "M-b": lambda percol: percol.command.backward_word(), "M-d": lambda percol: percol.command.delete_forward_word(), "M-h": lambda percol: percol.command.delete_backward_word(), "C-n": lambda percol: percol.command.select_next(), "C-p": lambda percol: percol.command.select_previous(), "C-v": lambda percol: percol.command.select_next_page(), "M-v": lambda percol: percol.command.select_previous_page(), "M-<": lambda percol: percol.command.select_top(), "M->": lambda percol: percol.command.select_bottom(), "C-m": lambda percol: percol.finish(), "C-j": lambda percol: percol.finish(), "C-g": lambda percol: percol.cancel(), })