Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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ケースの表示は標準とは少し違っています。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away