[from now] 2012/12/31 03:04:33

diff --git a/.bashrc b/.bashrc
index 3e09bcb..f2439a2 100644
--- a/.bashrc
+++ b/.bashrc
@@ -1,52 +1,212 @@
-unamestr=`uname`
+#
+# Env
+#
+#{{{
+stty stop undef
+export LANG='ja_JP.UTF-8'
+export HISTSIZE='10000000'
+export EDITOR='vi'
+export PAGER='less'
+export IGNOREEOF=3
+export GREP_OPTIONS='--color=auto'
+export GREP_COLOR='1;36'
+export PS1='\[\033[1;31m\]\u@\H\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\] \$ '
+export CLICOLOR=1
+export LSCOLORS=ExFxCxDxBxegedabagacad
+#}}}

-case $unamestr in
-  'Darwin')
+
+#
+# Alias
+#
+#{{{
+# bash-completion
+if [ -f `brew --prefix`/etc/bash_completion ]; then
+    . `brew --prefix`/etc/bash_completion
+fi
+
+# ls
+case "${OSTYPE}" in
+darwin*)
     alias  l='ls -lahG'
     alias ll='ls -lahG'
     alias ls='ls -ahG'
-
-    # bash-completion
-    if [ -f `brew --prefix`/etc/bash_completion ]; then
-      . `brew --prefix`/etc/bash_completion
-    fi
-
-    export PATH=/usr/local/sbin:/usr/local/bin:$PATH
     ;;
-
-  'Linux' | 'FreeBSD')
+linux*)
     alias  l='ls -lah --color'
     alias ll='ls -lah --color'
     alias ls='ls -ah  --color'
-
-    export PATH=/usr/local/sbin:/usr/local/bin:$PATH
     ;;
 esac

-export LANG='ja_JP.UTF-8'
-export HISTSIZE='10000000'
-export EDITOR='vi'
-export PAGER='less'
-export IGNOREEOF=3
-export GREP_OPTIONS='--color=auto'
-export GREP_COLOR='1;36'
+# process
+alias 'ps?'='pgrep -l -f'
+alias pk='pkill -f'
+alias jo="jobs -l"
+
+# du/df
+alias du="du -h"
+alias df="df -h"
+alias duh="du -h ./ --max-depth=1"
+
+# su
+alias su="su -l"
+
+# vim
+alias mvim='open -a MacVim'
+
+# less
+alias less='less -r'
+
+# grep
+alias 'gr'='grep -EIn --color=auto'
+alias 'grep'='grep -EIn --color=auto'
+
+# noglob
+# alias 'wget'='noglob wget'
+# alias 'curl'='noglob curl'
+
+# sublime
+alias 'li'='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl -o'
+
+# marked
+alias 'md'='open -a marked.app'
+
+# extract http://d.hatena.ne.jp/jeneshicc/20110215/1297778049
+extract () {
+  if [ -f $1 ] ; then
+      case $1 in
+          *.tar.bz2)   tar xvjf $1    ;;
+          *.tar.gz)    tar xvzf $1    ;;
+          *.tar.xz)    tar xvJf $1    ;;
+          *.bz2)       bunzip2 $1     ;;
+          *.rar)       unrar x $1     ;;
+          *.gz)        gunzip $1      ;;
+          *.tar)       tar xvf $1     ;;
+          *.tbz2)      tar xvjf $1    ;;
+          *.tgz)       tar xvzf $1    ;;
+          *.zip)       unzip $1       ;;
+          *.Z)         uncompress $1  ;;
+          *.7z)        7z x $1        ;;
+          *.lzma)      lzma -dv $1    ;;
+          *.xz)        xz -dv $1      ;;
+          *)           echo "don't know how to extract '$1'..." ;;
+      esac
+  else
+      echo "'$1' is not a valid file!"
+  fi
+}
+alias ex='extract'
+#}}}
+
+
+#
+# History
+#
+# {{{
+## historical backward/forward search with linehead string binded to ^P/^N
+#
+# autoload history-search-end
+# zle -N history-beginning-search-backward-end history-search-end
+# zle -N history-beginning-search-forward-end history-search-end
+# bindkey "^p" history-beginning-search-backward-end
+# bindkey "^n" history-beginning-search-forward-end
+# bindkey "\\ep" history-beginning-search-backward-end
+# bindkey "\\en" history-beginning-search-forward-end
+
+# # glob(*)によるインクリメンタルサーチ
+# bindkey '^R' history-incremental-pattern-search-backward
+# bindkey '^S' history-incremental-pattern-search-forward
+
+# ## Command history configuration
+# HISTFILE=~/.zsh_history
+# HISTSIZE=1000000
+# SAVEHIST=1000000
+# }}}
+
+
+#
+# Function
+#
+#{{{
+## Reload
+function reload() {
+  source ${HOME}/.bashrc
+}
+
+
+function rmf(){
+   for file in $*
+   do
+      __rm_single_file $file
+   done
+}
+
+
+function __rm_single_file(){
+       if ! [ -d ~/.Trash/ ]
+       then
+               command /bin/mkdir ~/.Trash
+       fi
+
+       if ! [ $# -eq 1 ]
+       then
+               echo "__rm_single_file: 1 argument required but $# passed."
+               exit
+       fi
+
+       if [ -e $1 ]
+       then
+               BASENAME=`basename $1`
+               NAME=$BASENAME
+               COUNT=0
+               while [ -e ~/.Trash/$NAME ]
+               do
+                       COUNT=$(($COUNT+1))
+                       NAME="$BASENAME.$COUNT"
+               done
+
+               command /bin/mv $1 ~/.Trash/$NAME
+       else
+               echo "No such file or directory: $file"
+       fi
+}
+#}}}
+
+
+#
+# import
+#
+# {{{
+## rbenv
+eval "$(rbenv init -)"
+
+
+## nvm
+[ -f ~/.nvm/nvm.sh ] && source ~/.nvm/nvm.sh
+[ -f $NVM_DIR/bash_completion ] && . $NVM_DIR/bash_completion
+
+
+## npm
+# qiita.com/items/d0cad46ecdec1e03bca8
+# export PATH=$PATH:$(npm bin -g 2>/dev/null)
+
+
+## jump
+_Z_CMD=j
+[ -f ~/.zsh/z.sh ] && source ~/.zsh/z.sh
+precmd() {
+  _z --add "$(pwd -P)"
+}
+
+
+## local固有設定
+[ -f ~/.bashrc.local ] && source ~/.bashrc.local
+# }}}
+
+
+
+

-stty stop undef

-#Black    0;30
-#Red      0;31
-#Green    0;32
-#Blue     0;34
-#Purple   0;35
-#Cyan     0;36
-#LGray    0;37
-#DGray    1;30
-#LRed     1;31
-#LGreen   1;32
-#Yellow   1;33
-#LBlue    1;34
-#LPurple  1;35
-#LCyan    1;36
-#White    1;37
-export PS1='\[\033[1;32m\]\u@\H\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\] \$ '

diff --git a/.zshrc b/.zshrc
index d600381..3da5633 100644
--- a/.zshrc
+++ b/.zshrc
@@ -403,20 +403,20 @@ setopt autopushd
 # bindkey '^K' cdup

 # ^JでLS
-function fastls() {
-echo
-case "${OSTYPE}" in
-  freebsd*|darwin*)
-  ls -lahG
-    ;;
-  linux*)
-  ls -lah --color
-    ;;
-esac
-zle reset-prompt
-}
-zle -N fastls
-bindkey '^J' fastls
+# function fastls() {
+# echo
+# case "${OSTYPE}" in
+  # freebsd*|darwin*)
+  # ls -lahG
+    # ;;
+  # linux*)
+  # ls -lah --color
+    # ;;
+# esac
+# zle reset-prompt
+# }
+# zle -N fastls
+# bindkey '^J' fastls

 # }}}

@@ -600,7 +600,7 @@ function __rm_single_file(){
 # }}}

 #
-# Exported
+# Import
 #
 # {{{
 ## Incremental completion on zsh
@@ -608,11 +608,6 @@ function __rm_single_file(){
 source ~/.zsh/incr*.zsh

-## rbenv-completion
-# https://github.com/sstephenson/rbenv/blob/master/completions/rbenv.zsh
-source ~/.zsh/rbenv.zsh
-
-
 ## Autojump on zsh
 # setopt complete_aliases を設定すると補完が効かない
 _Z_CMD=j
@@ -622,12 +617,18 @@ precmd() {
 }

-## rbenv
-eval "$(rbenv init -)"
+## npm
+# qiita.com/items/d0cad46ecdec1e03bca8
+export PATH=$PATH:$(npm bin -g 2>/dev/null)
+

+## rbenv-completion
+# https://github.com/sstephenson/rbenv/blob/master/completions/rbenv.zsh
+source ~/.zsh/rbenv.zsh

-## alias設定
-[ -f ~/.dotfiles/.zshrc.alias ] && source ~/.dotfiles/.zshrc.alias
+
+## rbenv
+eval "$(rbenv init - zsh)"

 ## local固有設定