LoginSignup
143
117

More than 5 years have passed since last update.

pecoでzshのコマンド履歴検索を超快適にする!

Last updated at Posted at 2015-07-14

peco を使うとかなり便利だということを知ったので導入メモ

注意:Mac環境です

peco のインストール

homebrewでインストール
brew install peco

Macで brew を導入している方は、 brewを使ってpecoをインストール。

詳細は http://github.com/peco/peco を参照

.zshrcに以下の内容を追加

~/.zshrc
function peco-history-selection() {
    BUFFER=`history -n 1 | tail -r  | awk '!a[$0]++' | peco`
    CURSOR=$#BUFFER
    zle reset-prompt
}

zle -N peco-history-selection
bindkey '^R' peco-history-selection

peco-history-selection関数を記述

exec zsh -l でzshを再ログインすると良い

準備完了!!

使い方

zsh上で Ctrl + R を押せば以下の感じで出てくる。
後は、インクリメンタルサーチで絞り込むだけ!
Screen Shot 2015-07-15 at 06.47.53.png

※ 画像はプライバシー保護のため、修正しているので右上のIgnoreケースの表示は標準とは少し違っています。

143
117
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
143
117