[from now] 2012/08/14 20:10:34

diff --git a/.vim/after/ftplugin/make.vim b/.vim/after/ftplugin/make.vim
index 0147abe..a6af172 100644
--- a/.vim/after/ftplugin/make.vim
+++ b/.vim/after/ftplugin/make.vim
@@ -1 +1,2 @@
-set noexpandtab
+
+setl noexpandtab
diff --git a/.vim/after/ftplugin/php.vim b/.vim/after/ftplugin/php.vim
index 6699045..8ec5647 100644
--- a/.vim/after/ftplugin/php.vim
+++ b/.vim/after/ftplugin/php.vim
@@ -1,2 +1,2 @@
-setl tabstop=2 shiftwidth=2 softtabstop=2
+
 nnoremap <buffer> <C-j><C-l> :w<CR>:!php -l %<CR>
diff --git a/.vim/after/ftplugin/python.vim b/.vim/after/ftplugin/python.vim
index 5a03c2a..66149d7 100644
--- a/.vim/after/ftplugin/python.vim
+++ b/.vim/after/ftplugin/python.vim
@@ -1,11 +1,5 @@

 " PEP 8 Indent rule
-setl tabstop=8
-setl softtabstop=4
-setl shiftwidth=4
-setl smarttab
-setl expandtab
-setl autoindent
 setl nosmartindent
 setl cindent
 setl textwidth=80
diff --git a/.vim/after/ftplugin/ruby.vim b/.vim/after/ftplugin/ruby.vim
index d779fbd..bbc8241 100644
--- a/.vim/after/ftplugin/ruby.vim
+++ b/.vim/after/ftplugin/ruby.vim
@@ -1,10 +1,2 @@

-setl tabstop=2
-setl softtabstop=2
-setl shiftwidth=2
-
-setl smarttab
-setl expandtab
-setl autoindent
-
 nnoremap <buffer> <C-j><C-l> :w<CR>:!ruby -c %<CR>
[from now] 2012/08/14 20:10:39

diff --git a/.vimrc b/.vimrc
index 450edf7..845731f 100644
--- a/.vimrc
+++ b/.vimrc
@@ -96,6 +96,7 @@ Bundle 'vim-scripts/taglist.vim'
 Bundle 'vim-scripts/Source-Explorer-srcexpl.vim'
 Bundle 'vim-scripts/buftabs'
 Bundle 'vim-scripts/mru.vim'
+Bundle 'vim-scripts/matchit.zip'
 Bundle 'Shougo/unite.vim'
 Bundle 'Shougo/vimproc'
 Bundle 'Shougo/vimshell'
@@ -114,9 +115,6 @@ Bundle 'godlygeek/tabular'
 Bundle 'nathanaelkane/vim-indent-guides'
 Bundle 'tpope/vim-surround'

-" 自動括弧閉じ
-Bundle 'Townk/vim-autoclose'
-
 "}}}

 " Ref"{{{
@@ -131,16 +129,16 @@ Bundle 'yuroyoro/vimdoc_ja'
 " Text-Object
 Bundle 'kana/vim-textobj-user'

-" viy
+" viy (シンタックス)
 Bundle 'kana/vim-textobj-syntax.git'

-" vi/
+" vi/ (最後の検索パターン)
 Bundle 'kana/vim-textobj-lastpat.git'

-" vii
+" vii (インデント)
 Bundle 'kana/vim-textobj-indent.git'

-" viz
+" viz (折りたたみ)
 Bundle 'kana/vim-textobj-fold.git'

 " vif (C & VimScript function)
@@ -149,8 +147,8 @@ Bundle 'kana/vim-textobj-function.git'
 " vif (javascript & perl function)
 Bundle 'thinca/vim-textobj-plugins.git'

-" vir (ruby)
-Bundle 'nelstrom/vim-textobj-rubyblock'
+" vir (ruby) " 分かりにくいので使わない
+" Bundle 'nelstrom/vim-textobj-rubyblock'

 "}}}

@@ -160,20 +158,6 @@ Bundle 'vim-scripts/applescript.vim'

 "}}}

-" Disabled Plugins"{{{
-" Bundle 'kana/vim-smartchr'
-" Bundle 'fholgado/minibufexpl.vim'
-" Bundle 'vim-scripts/AutoClose'
-" Bundle 'Townk/vim-autoclose'
-" Bundle 'tpope/vim-fugitive'
-" Bundle 'int3/vim-extradite'
-" Bundle 'reinh/vim-makegreen'
-" Bundle 'lambdalisue/nose.vim'
-" Bundle 'Lokaltog/vim-powerline'
-" Bundle 'mitechie/pyflakes-pathogen'
-" Bundle 'nvie/vim-flake8'
-"}}}
-
 " Python"{{{
 " omni
 Bundle 'vim-scripts/pythoncomplete'
@@ -192,6 +176,20 @@ Bundle 'vim-ruby/vim-ruby'
 Bundle 'tpope/vim-rails'
 "}}}

+" Disabled Plugins"{{{
+" Bundle 'kana/vim-smartchr'
+" Bundle 'fholgado/minibufexpl.vim'
+" Bundle 'vim-scripts/AutoClose'
+" Bundle 'Townk/vim-autoclose' " インデントのバグ有
+" Bundle 'tpope/vim-fugitive'
+" Bundle 'int3/vim-extradite'
+" Bundle 'reinh/vim-makegreen'
+" Bundle 'lambdalisue/nose.vim'
+" Bundle 'Lokaltog/vim-powerline'
+" Bundle 'mitechie/pyflakes-pathogen'
+" Bundle 'nvie/vim-flake8'
+"}}}
+

 Bundle 'gmarik/vundle'

@@ -217,6 +215,9 @@ augroup AUTO
   " 自動コメントをオフ
   autocmd FileType * set formatoptions-=ro

+  " インサートモードを抜ける時に:set nopaste
+  autocmd InsertLeave * set nopaste
+
 augroup END
 "}}}

@@ -236,10 +237,12 @@ colorscheme molokai
 syntax  on
 set     t_Co=256
 set     scrolloff=8
+set     autoindent
 set     smartindent
 set     tabstop=2
 set     shiftwidth=2
 set     softtabstop=2
+set     smarttab
 set     laststatus=2
 set     clipboard=unnamed
 set     foldmethod=marker
@@ -374,6 +377,40 @@ nnoremap <silent> <ESC><ESC> :nohlsearch<CR><ESC>
 "}}}

 "========================================
+" Indent
+"========================================
+"{{{
+if has("autocmd")
+  autocmd FileType apache     setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType aspvbs     setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType c          setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType cpp        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType cs         setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType css        setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType diff       setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType eruby      setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType html       setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType java       setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType javascript setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType perl       setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType php        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType python     setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType ruby       setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType haml       setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType sh         setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType sql        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType vb         setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType vim        setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType wsh        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType xhtml      setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType xml        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType yaml       setlocal sw=2 sts=2 ts=2 et
+  autocmd FileType zsh        setlocal sw=4 sts=4 ts=4 et
+  autocmd FileType scala      setlocal sw=2 sts=2 ts=2 et
+endif
+"}}}
+
+"========================================
 " Syntax
 "========================================
 "{{{
[from now] 2012/08/15 19:52:04

diff --git a/.vimrc b/.vimrc
index 845731f..5825e39 100644
--- a/.vimrc
+++ b/.vimrc
@@ -19,7 +19,7 @@
 " ターミナルからFinderを開く
 " open .
 "
-" vim からFinderを開く
+" vimからFinderを開く
 " :!open .
 "
 " 置換行為を繰り返す
@@ -28,10 +28,8 @@
 " :&&
 " &
 "
-"
-"
-"
-"
+" sudoでファイル保存
+" :w !sudo tee >/dev/null %
 "
 "
 "
@@ -97,6 +95,7 @@ Bundle 'vim-scripts/Source-Explorer-srcexpl.vim'
 Bundle 'vim-scripts/buftabs'
 Bundle 'vim-scripts/mru.vim'
 Bundle 'vim-scripts/matchit.zip'
+Bundle 'vim-scripts/sudo.vim'
 Bundle 'Shougo/unite.vim'
 Bundle 'Shougo/vimproc'
 Bundle 'Shougo/vimshell'
@@ -239,6 +238,7 @@ set     t_Co=256
 set     scrolloff=8
 set     autoindent
 set     smartindent
+set     cindent
 set     tabstop=2
 set     shiftwidth=2
 set     softtabstop=2
@@ -263,7 +263,6 @@ set     vb t_vb=
 " set   browsedir=buffer " Exploreの初期ディレクトリ
 " set   formatoptions=lmoq   " テキスト整形オプション，マルチバイト系を追加

-
 " カレントウィンドウにのみ罫線を引く
 set     cursorline
 augroup CSL
@@ -556,7 +555,6 @@ highlight IndentGuidesEven ctermbg=237 guibg=#333333
 "
 " http://www.karakaram.com/vim/neocomplcache/
 "
-
 "補完ウィンドウの設定
 set completeopt=menuone

@@ -616,8 +614,6 @@ endif
 " Define dictionary.
 let g:neocomplcache_dictionary_filetype_lists = {
     \ 'default' : '',
-    \ 'vimshell' : $HOME.'/.vimshell_hist',
-    \ 'scala' : $HOME.'/.vim/bundle/vim-scala/dict/scala.dict',
     \ 'java' : $HOME.'/.vim/dict/java.dict',
     \ 'c' : $HOME.'/.vim/dict/c.dict',
     \ 'cpp' : $HOME.'/.vim/dict/cpp.dict',
@@ -677,8 +673,6 @@ nnoremap <silent> [unite]f  :<C-u>VimFilerCurrentDir  -quit<CR>
 nnoremap <silent> [unite]s  :<C-u>VimShell<CR>
 nnoremap <silent> [unite]u  :<C-u>MRU<CR>

-" let g:unite_source_file_mru_limit = 500
-
 if executable('grep')
   let g:unite_source_grep_command = 'grep'
   let g:unite_source_grep_default_opts = '-ERIn --color=never'
diff --git a/.zsh/rbenv.zsh b/.zsh/rbenv.zsh
new file mode 100755
index 0000000..9aead31
--- /dev/null
+++ b/.zsh/rbenv.zsh
@@ -0,0 +1,22 @@
+# https://github.com/sstephenson/rbenv/blob/master/completions/rbenv.zsh
+
+if [[ ! -o interactive ]]; then
+    return
+fi
+
+compctl -K _rbenv rbenv
+
+_rbenv() {
+    local word words completions
+    read -cA words
+    word="${words[2]}"
+
+    if [ "${#words}" -eq 2 ]; then
+        completions="$(rbenv commands)"
+    else
+        completions="$(rbenv completions "${word}")"
+    fi
+
+    reply=("${(ps:\n:)completions}")
+}
+
diff --git a/.zshrc b/.zshrc
index 570de0e..594921a 100644
--- a/.zshrc
+++ b/.zshrc
@@ -1,11 +1,23 @@
 ## Environment variable configuration

 #
-# PATH
+# ENV
 #
+# {{{
+## パス
 export PATH=/usr/local/sbin:/usr/local/bin:$PATH
 export MANPATH=/usr/local/share/man:$MANPATH

+## 言語
+# http://curiousabt.blog27.fc2.com/blog-entry-65.html
+export LANG=ja_JP.UTF-8
+export LESSCHARSET=utf-8
+
+## 補完上限
+# http://d.hatena.ne.jp/tsaka/20060923/1158993348
+export LISTMAX=200
+# }}}
+
 #
 # Alias
 #
@@ -80,22 +92,6 @@ alias vimrc='vi ~/.dotfiles/.vimrc*'
 # }}}

 #
-# LANG
-#
-# {{{
-# http://curiousabt.blog27.fc2.com/blog-entry-65.html
-export LANG=ja_JP.UTF-8
-export LESSCHARSET=utf-8
-
-# Backspace key
-bindkey "^?" backward-delete-char
-
-# Bindkey
-bindkey -e
-
-# }}}
-
-#
 # Color
 #
 # {{{
@@ -413,27 +409,66 @@ select-word-style default
 zstyle ':zle:*' word-chars " _-./;@"
 zstyle ':zle:*' word-style unspecified

+
 # URLをコピペしたときに自動でエスケープ
 autoload -Uz url-quote-magic
 zle -N self-insert url-quote-magic

+
 ## Completion configuration
 #
 fpath=(~/.zsh/functions/Completion ${fpath})
 autoload -U compinit
 compinit -u

+
 ## Prediction configuration
 # autoload predict-on

+
 ## Command Line Stack [Esc]-[q]
 bindkey -a 'q' push-line

+
+# Backspace key
+bindkey "^?" backward-delete-char
+
+
+# Bindkey
+bindkey -e
+
+
 ## Reload
 function reload() {
   source ${HOME}/.zshrc
 }

+
+## Sudo vim
+# http://blog.monoweb.info/article/2011120320.html
+sudo() {
+  local args
+  case $1 in
+    vi|vim)
+      args=()
+      for arg in $@[2,-1]
+      do
+        if [ $arg[1] = '-' ]; then
+          args[$(( 1+$#args ))]=$arg
+        else
+          args[$(( 1+$#args ))]="sudo:$arg"
+        fi
+      done
+      command vim $args
+      ;;
+    *)
+      command sudo $@
+      ;;
+  esac
+}
+
+
+
 # }}}

 #
@@ -551,21 +586,30 @@ function __rm_single_file(){
 #  http://mimosa-pudica.net/src/incr-0.2.zsh
 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
 source ~/.zsh/z.sh
 precmd() {
   _z --add "$(pwd -P)"
 }

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

+
 ## local固有設定
-#
 [ -f ~/.zshrc.local ] && source ~/.zshrc.local
 # }}}