[from now] 2014/10/17 12:28:34

diff --git a/Brewfile b/Brewfile
index 332901f..158fb12 100644
--- a/Brewfile
+++ b/Brewfile
@@ -23,6 +23,11 @@ install unzip
 install --disable-etcdir zsh
 install zsh-completions
 install autojump
+install z
+
+# git
+install git
+install tig

 # python
 install python3
@@ -38,9 +43,8 @@ install rbenv-gemset
 install ruby-build
 install sqlite

-# git
-install git
-install tig
+# go
+install go

 # lua
 install lua
diff --git a/peco.config.json b/peco.config.json
new file mode 100644
index 0000000..880acb1
--- /dev/null
+++ b/peco.config.json
@@ -0,0 +1,15 @@
+{
+  "InitialMatcher": "SmartCase",
+  "Keymap": {
+    "C-a": "peco.SelectAll",
+    "C-s": "peco.ToggleSelectionAndSelectNext"
+  },
+  "Prompt": "[peco]",
+  "Style": {
+    "Basic": ["on_default", "default"],
+    "Matched": ["bold", "blue"],
+    "SavedSelection": ["bold", "reverse"],
+    "Selected": ["underline", "on_bold", "reverse"],
+    "Query": ["blue", "on_white"]
+  }
+}
diff --git a/zshrc b/zshrc
index 72dfdf6..2b4e013 100644
--- a/zshrc
+++ b/zshrc
@@ -117,6 +117,9 @@ HISTFILE=${HOME}/.zsh_history
 HISTSIZE=50000
 SAVEHIST=50000
 setopt hist_ignore_all_dups
+setopt hist_ignore_dups
+setopt hist_expand
+setopt hist_ignore_space
 setopt extended_history
 setopt share_history

diff --git a/zshrc.mine.mac b/zshrc.mine.mac
index 97014f4..acdb025 100644
--- a/zshrc.mine.mac
+++ b/zshrc.mine.mac
@@ -51,34 +51,49 @@ fi
 autoload -U compinit
 compinit -u

-## Peco
+## Go
 #
-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
+if [ -x "`which go`" ]; then
+  export GOPATH=$HOME/go/
+  export GOROOT=`go env GOROOT`
+  export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
+fi

+## Peco
+# brew tap peco/peco
+#
 if [ -x "`which peco`" ]; then
   alias ll='ls -la | peco'
   alias top='top | peco'
   alias ps='ps aux | peco'
-  bindkey '^r' peco-select-history
-fi

-## Go
-#
-if [ -x "`which go`" ]; then
-  export GOPATH=$HOME/go/
-  export GOROOT=`go env GOROOT`
-  export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
+  function peco-select-history () {
+    local tac
+    if which gtac > /dev/null; then
+      tac="gtac"
+    elif which tac > /dev/null; then
+      tac="tac"
+    else
+      tac="tail -r"
+    fi
+    BUFFER=$(\history -n 1 | eval $tac | peco --query "$LBUFFER")
+    CURSOR=$#BUFFER # move cursor
+    #zle -R -c       # refresh
+  }
+  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 -R -c
+  }
+  zle -N peco-cdr
+
+  bindkey '^r' peco-select-history
+  bindkey '^j' peco-cdr
 fi

 ## z.sh (https://github.com/rupa/z)
@@ -87,6 +102,7 @@ fi
 #
 source `brew --prefix`/etc/profile.d/z.sh
 _Z_CMD=j
+compctl -U -K _z_zsh_tab_completion "$_Z_CMD"

 ## Haxe
 #
@@ -102,7 +118,9 @@ alias iTunesSync='rsync -aurvz --delete --exclude ".DS_Store" -e ssh ~/Music/iTu

 ## Login Message
 #
+echo -e "\e[33m [Uptime & Who] \e[m"
 w
 if [ -x "`which fortune`" ]; then
+  echo -e "\n\e[33m [Today's fortune] \e[m"
   fortune
 fi