参考サイト
- vim使っているrubyistで、これ入れていないのはヤバいプラグインまとめ 16個 (2013-01更新)
- 正しいcoffee-scriptの環境づくり vim
- nerdtree plugin to integrate nerdtree with :grep
.vimrc
.vimrc
" =============== NeoBundle START ===============
set nocompatible " be iMproved
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle/'))
endif
" originalrepos on github
"NeoBundle 'Shougo/neobundle.vim'
"NeoBundle 'Shougo/vimproc'
"NeoBundle 'VimClojure'
"NeoBundle 'Shougo/vimshell'
"NeoBundle 'Shougo/unite.vim'
"NeoBundle 'Shougo/neocomplcache'
"NeoBundle 'Shougo/neocomplcache-snippets-complete'
"NeoBundle 'jpalardy/vim-slime'
"NeoBundle 'scrooloose/syntastic'
""NeoBundle 'https://bitbucket.org/kovisoft/slimv'
" neobundle"{{{
" コマンドを伴うやつの遅延読み込み
"bundle"{{{
" その他 {{{
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
NeoBundleLazy 'taichouchou2/vim-endwise.git', {
\ 'autoload' : {
\ 'insert' : 1,
\ } }
" }}}
" 補完 {{{
NeoBundleLazy 'Shougo/neocomplcache', {
\ 'autoload' : {
\ 'insert' : 1,
\ }}
NeoBundleLazy 'Shougo/neosnippet', {
\ 'autoload' : {
\ 'insert' : 1,
\ }}
NeoBundle 'Shougo/neocomplcache-rsense', {
\ 'depends': 'Shougo/neocomplcache',
\ 'autoload': { 'filetypes': 'ruby' }}
NeoBundleLazy 'taichouchou2/rsense-0.3', {
\ 'build' : {
\ 'mac': 'ruby etc/config.rb > ~/.rsense',
\ 'unix': 'ruby etc/config.rb > ~/.rsense',
\ } }
" }}}
" 便利 {{{
" 範囲指定のコマンドが使えないので、tcommentのLazy化はNeoBundleのアップデートを待ちましょう...
NeoBundle 'tomtom/tcomment_vim'
NeoBundleLazy 'tpope/vim-surround', {
\ 'autoload' : {
\ 'mappings' : [
\ ['nx', '<Plug>Dsurround'], ['nx', '<Plug>Csurround'],
\ ['nx', '<Plug>Ysurround'], ['nx', '<Plug>YSurround'],
\ ['nx', '<Plug>Yssurround'], ['nx', '<Plug>YSsurround'],
\ ['nx', '<Plug>YSsurround'], ['vx', '<Plug>VgSurround'],
\ ['vx', '<Plug>VSurround']
\ ]}}
" }}}
" ruby / railsサポート {{{
NeoBundle 'tpope/vim-rails'
NeoBundleLazy 'ujihisa/unite-rake', {
\ 'depends' : 'Shougo/unite.vim' }
NeoBundleLazy 'basyura/unite-rails', {
\ 'depends' : 'Shjkougo/unite.vim' }
NeoBundleLazy 'taichouchou2/unite-rails_best_practices', {
\ 'depends' : 'Shougo/unite.vim',
\ 'build' : {
\ 'mac': 'gem install rails_best_practices',
\ 'unix': 'gem install rails_best_practices',
\ }
\ }
NeoBundleLazy 'taichouchou2/unite-reek', {
\ 'build' : {
\ 'mac': 'gem install reek',
\ 'unix': 'gem install reek',
\ },
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] },
\ 'depends' : 'Shougo/unite.vim' }
NeoBundleLazy 'taichouchou2/alpaca_complete', {
\ 'depends' : 'tpope/vim-rails',
\ 'build' : {
\ 'mac': 'gem install alpaca_complete',
\ 'unix': 'gem install alpaca_complete',
\ }
\ }
let s:bundle_rails = 'unite-rails unite-rails_best_practices unite-rake alpaca_complete'
function! s:bundleLoadDepends(bundle_names) "{{{
" bundleの読み込み
execute 'NeoBundleSource '.a:bundle_names
au! RailsLazyPlugins
endfunction"}}}
aug RailsLazyPlugins
au User Rails call <SID>bundleLoadDepends(s:bundle_rails)
aug END
" reference環境
NeoBundleLazy 'vim-ruby/vim-ruby', {
\ 'autoload' : { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'taka84u9/vim-ref-ri', {
\ 'depends': ['Shougo/unite.vim', 'thinca/vim-ref'],
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'skwp/vim-rspec', {
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'ruby-matchit', {
\ 'autoload' : { 'filetypes': ['ruby', 'eruby', 'haml'] } }
" }}}
" }}}
"}}}
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'vim-coffee-script'
" syntax + 自動compile
NeoBundle 'kchmck/vim-coffee-script'
" js BDDツール
NeoBundle 'claco/jasmine.vim'
" indentの深さに色を付ける
NeoBundle 'nathanaelkane/vim-indent-guides'
filetype plugin indent on " required!
filetype indent on
syntax on
" =============== NeoBundle END ===============
set nobackup
set noswapfile
" for ruby
set tabstop=2
set shiftwidth=2
set expandtab
" for java
"set tabstop=4
"set shiftwidth=2
set paste
set autoindent " always set autoindenting on
colorscheme murphy
" 大文字小文字を区別
set noic
" quickrun
silent! nmap <unique> qu <Plug>(quickrun)
au QuickfixCmdPost vimgrep cw
"タブ、空白、改行を可視化
"set list
set listchars=tab:»-,trail:-,eol:↲,extends:»,precedes:«,nbsp:%
NERDTreeにgrepメニューを追加
~/.vim/bundle/nerdtree/nerdtree_plugin/grep_menuitem.vim
"shove this in ~/.vim/nerdtree_plugin/grep_menuitem.vim
"
"A really rough integration of :grep with nerdtree. Adds a 'g' menu item that
"prompts the user for a search pattern to use with :grep. :grep is run on the
"selected dir (using the parent if a file is selected)
"
" Originally written by scrooloose
" (http://gist.github.com/205807)
if exists("g:loaded_nerdtree_grep_menuitem")
finish
endif
let g:loaded_nerdtree_grep_menuitem = 1
call NERDTreeAddMenuItem({
\ 'text': '(g)rep directory',
\ 'shortcut': 'g',
\ 'callback': 'NERDTreeGrep' })
function! NERDTreeGrep()
let dirnode = g:NERDTreeDirNode.GetSelected()
let pattern = input("Enter the search pattern: ")
if pattern == ''
echo 'Aborted'
return
endif
"use the previous window to jump to the first search result
wincmd w
"a hack for *nix to make sure the output of "grep" isnt echoed in vim
let old_shellpipe = &shellpipe
let &shellpipe='&>'
try
exec 'silent cd ' . dirnode.path.str()
exec 'silent grep -rn ' . pattern . ' .'
" exec 'silent grep -rn ' . pattern . ' ' . dirnode.path.str()
finally
let &shellpipe = old_shellpipe
endtry
let hits = len(getqflist())
if hits == 0
echo "No hits"
elseif hits > 1
copen
" echo "Multiple hits. Jumping to first, use :copen to see them all."
endif
endfunction