15
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu12.04にGoを入れてPecoが使えるようになるまで(bash編)

Last updated at Posted at 2014-09-11

Ubuntu12.04のbashでPecoを使いたかったので整理してみた。

#Go のインストール

####wget, git がなければ入れておく

sudo apt-get -y install wget
sudo apt-get -y install git-core

####ソースコードDL & インストール

wget https://go.googlecode.com/files/go1.2rc2.linux-amd64.tar.gz
sudo tar zxvf ~/go1.2rc2.linux-amd64.tar.gz -C /usr/local

####.bashrcに追記

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

####確認

source .bashrc
which go

#Peco のインストール & 設定
####インストール(数秒待つ)

go get github.com/peco/peco/cmd/peco

####.bashrcに追記

peco-select-history() {
    declare l=$(HISTTIMEFORMAT= history | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\s*//; $in=$_; if (!(grep {$in eq $_} @lines)) { push(@lines, $in); print $in; }' | peco --query "$READLINE_LINE")
    READLINE_LINE="$l"
    READLINE_POINT=${#l}
}
bind -x '"\C-r": peco-select-history'
bind    '"\C-xr": reverse-search-history'

####確認

source .bashrc
which peco

#使ってみる
####Ctrl-r
peco.png

####Ctrl-xr
従来のコマンド履歴検索が起動される。

#参考サイト thx!
centos,bash環境でpecoを導入してコマンド履歴を便利にするまで。
http://qiita.com/fortkle/items/52c1077a7963cb01c596

bash/zsh のヒストリを peco で便利にする
http://qiita.com/comutt/items/f54e755f22508a6c7d78

ubuntu (Xubuntu) 14.04LTS で golang のインストールと SublimeText3 の設定
http://elfcobe.hateblo.jp/entry/2014/05/07/193820

15
15
0

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
15
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?