[from now] 2014/10/15 12:45:31

diff --git a/zshrc b/zshrc
index a04342d..cba0a69 100644
--- a/zshrc
+++ b/zshrc
@@ -53,6 +53,17 @@ setopt auto_cd
 #
 setopt auto_pushd

+## 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 5000
+  zstyle ':chpwd:*' recent-dirs-default yes
+  zstyle ':completion:*' recent-dirs-insert both
+fi
+
 # command correct edition before each completion attempt
 #
 setopt correct
diff --git a/zshrc.mine.mac b/zshrc.mine.mac
index 31fbbf9..6adcac9 100644
--- a/zshrc.mine.mac
+++ b/zshrc.mine.mac
@@ -1,4 +1,4 @@
-# LastModified: 2014/04/07
+# LastModified: 2014/10/15

 ################################################
 # for MacOS X
@@ -51,6 +51,39 @@ fi
 autoload -U compinit
 compinit -u

+## Peco
+#
+function peco-select-history () {
+  local tac
+  if which tac > /dev/bull; 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
+
+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
+
+if [ -x "`which peco`" ]; then
+  alias ll='ls -la | peco'
+  alias top='top | peco'
+  alias ps='ps aux | peco'
+  bindkey '^r' peco-select-history
+  bundkey '^xr' peco-cdr
+fi
+
 ## Haxe
 #
 export HAXE_STD_PATH="/usr/local/lib/haxe/std"
@@ -66,6 +99,6 @@ alias iTunesSync='rsync -aurvz --delete --exclude ".DS_Store" -e ssh ~/Music/iTu
 ## Login Message
 #
 w
-if [ -e /usr/local/bin/fortune ]; then
+if [ -x "`which fortune`" ]; then
   fortune
 fi