べ、別にgrepしないわけじゃないんだからね!///

grepするなら当然vim内蔵grepっしょ。

:vim /hogehoge/ **/*.txt

パイプでcwに渡すとquickfixに流れる。

:vim /hogehoge/ **/*.txt | cw

裏で流れてるから:cwすれば見えるけどね。
quickfixからしか使わないのであれば

autocmd QuickfixCmdPost vimgrep cw

しとけば、常にquickfixウィンドウが表示されるようになる。

マカーなぺちぱーがVimでctagsとcscopeを使うための設定

「えー マジgrep!?」「キモーイ」「ソースコード追うのにgrepが許されるのは小学生までだよね!」「キャハハハハハハ」
ってことで、ctagsとcscopeを有効に使う。
マカーとかぺちぱーとか実はあんまし関係ないけど。

$ brew install ctags
$ brew install cscope

vimmerならtaglist.vimとsrcexpl.vimは必要。

NeoBundle 'taglist.vim'
NeoBundle 'Source-Explorer-srcexpl.vim'
" で、:NeoBundleInstall

Homebrewだと/usr/local/binにインスコされるのでいろいろと設定してあげる。

" ~/.vimrc
let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
let g:SrcExpl_updateTagsCmd = "/usr/local/bin/ctags --sort=foldcase -R ."

taglistで変数まで表示されるとウザいので

let tlist_php_settings = 'php;c:class;d:constant;f:function'

cscopeの設定。

if has("cscope")
  set csprg=/usr/local/bin/cscope
  set csto=0
  set cst
  set nocsverb
  " add any database in current directory
  if filereadable("cscope.out")
    cs add cscope.out
  " else add database pointed to by environment 
  elseif $CSCOPE_DB != ""
    cs add $CSCOPE_DB
  endif
  set csverb
  set cscopequickfix=s-,c-,d-,i-,t-,e-
endif

centosの/etc/vimrcかなんかからコピってきた。

:Tlist
:SrcExplToggle

で下みたいになる。
f:id:jhoshina:20120117155311p:plain
んで、クラス名でCtrl+]押せば、
f:id:jhoshina:20120117155448p:plain
とquickfixにリストが出て選べる。

Vimのプラグイン管理にNeoBundleを使うことにした

元々あんましプラグイン管理とかしてなかったんだけど、あちこちの環境で拾ってきてインスコしての繰り返しがめんどくさくなったので。
http://github.com/gmarik/vundle使ってみたんだけど、http://github.com/Shougo/neobundle.vimが面白そうだったのでこっちを使うことに。
以下、https://github.com/Shougo/neobundle.vim/blob/master/README.mdのほぼコピペ。

mkdir -p ~/.vim/bundle
git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
set nocompatible               " be iMproved
filetype plugin indent off     " required!

if has('vim_starting')
  set runtimepath+=~/.vim/bundle/neobundle.vim/
  call neobundle#rc(expand('~/.vim/bundle/'))
endif
" let NeoBundle manage NeoBundle
" required! 
"NeoBundle 'Shougo/neobundle.vim'
" recommended to install
NeoBundle 'Shougo/vimproc'
" after install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
NeoBundle 'Shougo/vimshell'
NeoBundle 'Shougo/unite.vim'

" My Bundles here:
"
" " original repos on github
" NeoBundle 'tpope/vim-fugitive'
" NeoBundle 'Lokaltog/vim-easymotion'
" NeoBundle 'rstacruz/sparkup', {'rtp': 'vim/'}
" " vim-scripts repos
" NeoBundle 'L9'
" NeoBundle 'FuzzyFinder'
" NeoBundle 'rails.vim'
" " non github repos
" NeoBundle 'git://git.wincent.com/command-t.git'
" " non git repos
" NeoBundle 'http://svn.macports.org/repository/macports/contrib/mpvim/'
" NeoBundle 'https://bitbucket.org/ns9tks/vim-fuzzyfinder'

NeoBundle 'vim-jp/vimdoc-ja'

" ...

filetype plugin indent on     " required!
"
" Brief help
" :NeoBundleList          - list configured bundles
" :NeoBundleInstall(!)    - install(update) bundles
" :NeoBundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"

Searchがなくてめんどいが、vim-script reposの正しいプラグイン名称はここで取れる。
http://vim-scripts.org/vim/scripts.html