$ wget http://www.zsh.org/pub/zsh-5.0.8.tar.gz
$ tar zxvf zsh-5.0.8.tar.gz
$ cd zsh-5.0.8
$ ./configue
$ make
$ sudo make install
$sudo -e /etc/shells
/usr/local/bin/zsh
$ chsh
新しいシェル [/bin/bash]: /usr/local/bin/zsh
シェルを変更しました。
go を入れる
$wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
$tar zxvf go1.4.2.linux-amd64.tar.gz
$sudo tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.gz
$emacs ~/.zshrc
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
$source ~/.zshrc
$exec $SHELL -l
peco を入れる
$go get github.com/peco/peco/cmd/peco
#----- cdr
autoload -Uz is-at-least
if is-at-least 4.3.11
then
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-max 1000
zstyle ':chpwd:*' recent-dirs-default yes
zstyle ':completion:*' recent-dirs-insert both
fi
function peco-cdr () {
local selected_dir=$(cdr -l | awk '{ print $2 }' | peco)
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-cdr
bindkey '^xr' peco-cdr
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
peco --query "$LBUFFER")
CURSOR=$#BUFFER
zle clear-screen
}
zle -N peco-select-history
bindkey '^r' peco-select-history
参考: