" neobundle"{{{ filetype plugin indent off " required! " initialize"{{{ if has('vim_starting') let bundle_dir = '~/.bundle' if !isdirectory(bundle_dir.'/neobundle.vim') call system( 'git clone https://github.com/Shougo/neobundle.vim.git '.bundle_dir.'/neobundle.vim') endif exe 'set runtimepath+='.bundle_dir.'/neobundle.vim' call neobundle#rc(bundle_dir) endif augroup MyNeobundle au! au Syntax vim syntax keyword vimCommand NeoBundle NeoBundleLazy NeoBundleSource NeoBundleFetch augroup END "}}} " 暫定customize {{{ function! Neo_al(ft) "{{{ return { 'autoload' : { \ 'filetype' : a:ft \ }} endfunction"}}} function! Neo_operator(mappings) "{{{ return { \ 'depends' : 'kana/vim-textobj-user', \ 'autoload' : { \ 'mappings' : a:mappings \ }} endfunction"}}} function! BundleLoadDepends(bundle_names) "{{{ if !exists('g:loaded_bundles') let g:loaded_bundles = {} endif " bundleの読み込み if !has_key( g:loaded_bundles, a:bundle_names ) execute 'NeoBundleSource '.a:bundle_names let g:loaded_bundles[a:bundle_names] = 1 endif endfunction"}}} "}}} " コマンドを伴うやつの遅延読み込み function! BundleWithCmd(bundle_names, cmd) "{{{ call BundleLoadDepends(a:bundle_names) " コマンドの実行 if !empty(a:cmd) execute a:cmd endif endfunction "}}} "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', 'Dsurround'], ['nx', 'Csurround'], \ ['nx', 'Ysurround'], ['nx', 'YSurround'], \ ['nx', 'Yssurround'], ['nx', 'YSsurround'], \ ['nx', 'YSsurround'], ['vx', 'VgSurround'], \ ['vx', '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! MyAutoCmd endfunction"}}} aug MyAutoCmd au User Rails call 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'] } } " }}} " }}} " Installation check. "{{{ if neobundle#exists_not_installed_bundles() echomsg 'Not installed bundles : ' . \ string(neobundle#get_not_installed_bundle_names()) echomsg 'Install Plugins' NeoBundleInstall endif "}}} filetype plugin indent on "}}} " plugin settings"{{{ "------------------------------------ " endwise.vim "------------------------------------ "{{{ let g:endwise_no_mappings=1 "}}} "------------------------------------ " vim-surround "------------------------------------ " {{{ nmap ds Dsurround nmap cs Csurround nmap ys Ysurround nmap yS YSurround nmap yss Yssurround nmap ySs YSsurround nmap ySS YSsurround xmap S VSurround xmap gS VgSurround vmap s VSurround " surround_custom_mappings.vim"{{{ let g:surround_custom_mapping = {} let g:surround_custom_mapping._ = { \ 'p': "
 \r 
", \ 'w': "%w(\r)", \ } let g:surround_custom_mapping.help = { \ 'p': "> \r <", \ } let g:surround_custom_mapping.ruby = { \ '-': "<% \r %>", \ '=': "<%= \r %>", \ '9': "(\r)", \ '5': "%(\r)", \ '%': "%(\r)", \ 'w': "%w(\r)", \ '#': "#{\r}", \ '3': "#{\r}", \ 'e': "begin \r end", \ 'E': "< neocomplcache#undo_completion() imap neocomplcache#smart_close_popup() . "" . "DiscretionaryEnd" imap pumvisible() ? "\" : "\" " imap pumvisible() ? "\" : "\" imap neosnippet#expandable() ? "\(neosnippet_jump_or_expand)" : pumvisible() ? "\" : "\" " }}} "}}} "------------------------------------ " neosnippet "------------------------------------ " neosnippet "{{{ " snippetを保存するディレクトリを設定してください " example " let s:default_snippet = neobundle#get_neobundle_dir() . '/neosnippet/autoload/neosnippet/snippets' " 本体に入っているsnippet " let s:my_snippet = '~/snippet' " 自分のsnippet " let g:neosnippet#snippets_directory = s:my_snippet " let g:neosnippet#snippets_directory = s:default_snippet . ',' . s:my_snippet imap (neosnippet_expand_or_jump) inoremap :Unite snippet nnoremap e :NeoSnippetEdit -split smap (neosnippet_expand_or_jump) " xmap o (neosnippet_register_oneshot_snippet) "}}} "------------------------------------ " vim-rails "------------------------------------ ""{{{ "有効化 let g:rails_default_file='config/database.yml' let g:rails_level = 4 let g:rails_mappings=1 let g:rails_modelines=0 " let g:rails_some_option = 1 " let g:rails_statusline = 1 " let g:rails_subversion=0 " let g:rails_syntax = 1 " let g:rails_url='http://localhost:3000' " let g:rails_ctags_arguments='--languages=-javascript' " let g:rails_ctags_arguments = '' function! SetUpRailsSetting() nnoremap r :R nnoremap a :A nnoremap m :Rmodel nnoremap c :Rcontroller nnoremap v :Rview nnoremap p :Rpreview endfunction aug MyAutoCmd au User Rails call SetUpRailsSetting() aug END aug RailsDictSetting au! aug END "}}} "------------------------------------ " Unite-rails.vim "------------------------------------ "{{{ function! UniteRailsSetting() nnoremap :Unite rails/view nnoremap :Unite rails/model nnoremap :Unite rails/controller nnoremap c :Unite rails/config nnoremap s :Unite rails/spec nnoremap m :Unite rails/db -input=migrate nnoremap l :Unite rails/lib nnoremap g ':e '.b:rails_root.'/Gemfile' nnoremap r ':e '.b:rails_root.'/config/routes.rb' nnoremap se ':e '.b:rails_root.'/db/seeds.rb' nnoremap ra :Unite rails/rake nnoremap h :Unite rails/heroku endfunction aug MyAutoCmd au User Rails call UniteRailsSetting() aug END "}}} "---------------------------------------- " vim-ref "---------------------------------------- "{{{ let g:ref_open = 'split' let g:ref_refe_cmd = expand('~/.vim/ref/ruby-ref1.9.2/refe-1_9_2') nnoremap rr :Unite ref/refe -default-action=split -input= nnoremap ri :Unite ref/ri -default-action=split -input= aug MyAutoCmd au FileType ruby,eruby,ruby.rspec nnoremap KK :Unite -no-start-insert ref/ri -input= au FileType ruby,eruby,ruby.rspec nnoremap K :Unite -no-start-insert ref/refe -input= aug END "}}} "------------------------------------ " Unite-reek, Unite-rails_best_practices "------------------------------------ " {{{ nnoremap [unite] :Unite -no-quit reek nnoremap [unite] :Unite -no-quit rails_best_practices " }}} "}}}