From b5f611441abd05da0765d66adaeb27bb6ef9edb8 Mon Sep 17 00:00:00 2001 From: tevio Date: Sat, 19 Jul 2014 14:25:07 +0100 Subject: [PATCH] use vundle for the bulk of deps --- .gitmodules | 54 +----------- README.md | 2 + bundle.vimrc | 24 ++++++ bundle/ack | 1 - bundle/ag | 1 - bundle/auto-save | 1 - bundle/ctrlp | 1 - bundle/fugitive | 1 - bundle/jasmine | 1 - bundle/kwbd | 1 - bundle/localvimrc | 1 - bundle/nerdcommenter | 1 - bundle/nerdtree | 1 - bundle/rails | 1 - bundle/rspec | 1 - bundle/ruby-matchit | 1 - bundle/supertab | 1 - bundle/surround | 1 - bundle/syntastic | 1 - bundle/vundle | 1 + bundle/zoomwin | 1 - internal.vimrc | 197 ++++++++++++++++++++++++++++++++++++++++++ vimrc | 199 +------------------------------------------ 23 files changed, 229 insertions(+), 265 deletions(-) create mode 100644 bundle.vimrc delete mode 160000 bundle/ack delete mode 160000 bundle/ag delete mode 160000 bundle/auto-save delete mode 160000 bundle/ctrlp delete mode 160000 bundle/fugitive delete mode 160000 bundle/jasmine delete mode 160000 bundle/kwbd delete mode 160000 bundle/localvimrc delete mode 160000 bundle/nerdcommenter delete mode 160000 bundle/nerdtree delete mode 160000 bundle/rails delete mode 160000 bundle/rspec delete mode 160000 bundle/ruby-matchit delete mode 160000 bundle/supertab delete mode 160000 bundle/surround delete mode 160000 bundle/syntastic create mode 160000 bundle/vundle delete mode 160000 bundle/zoomwin create mode 100644 internal.vimrc diff --git a/.gitmodules b/.gitmodules index dbd21cd..7fa73dc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,54 +1,6 @@ -[submodule "bundle/kwbd"] - path = bundle/kwbd - url = http://github.com/rgarver/Kwbd.vim.git -[submodule "bundle/zoomwin"] - path = bundle/zoomwin - url = http://github.com/vim-scripts/ZoomWin -[submodule "bundle/ack"] - path = bundle/ack - url = http://github.com/vim-scripts/ack.vim.git -[submodule "bundle/ag"] - path = bundle/ag - url = http://github.com/epmatsw/ag.vim.git -[submodule "bundle/ctrlp"] - path = bundle/ctrlp - url = http://github.com/kien/ctrlp.vim.git -[submodule "bundle/jasmine"] - path = bundle/jasmine - url = http://github.com/claco/jasmine.vim.git -[submodule "bundle/nerdcommenter"] - path = bundle/nerdcommenter - url = http://github.com/scrooloose/nerdcommenter.git -[submodule "bundle/nerdtree"] - path = bundle/nerdtree - url = http://github.com/scrooloose/nerdtree.git -[submodule "bundle/ruby-matchit"] - path = bundle/ruby-matchit - url = http://github.com/vim-scripts/ruby-matchit.git -[submodule "bundle/supertab"] - path = bundle/supertab - url = http://github.com/ervandew/supertab.git -[submodule "bundle/syntastic"] - path = bundle/syntastic - url = http://github.com/scrooloose/syntastic.git -[submodule "bundle/fugitive"] - path = bundle/fugitive - url = http://github.com/tpope/vim-fugitive.git [submodule "bundle/gitgrep"] path = bundle/gitgrep url = http://github.com/aghareza/vim-gitgrep.git -[submodule "bundle/rails"] - path = bundle/rails - url = http://github.com/tpope/vim-rails.git -[submodule "bundle/rspec"] - path = bundle/rspec - url = http://github.com/thoughtbot/vim-rspec.git -[submodule "bundle/surround"] - path = bundle/surround - url = http://github.com/tpope/vim-surround.git -[submodule "bundle/auto-save"] - path = bundle/auto-save - url = https://github.com/vim-scripts/vim-auto-save.git -[submodule "bundle/localvimrc"] - path = bundle/localvimrc - url = https://github.com/embear/vim-localvimrc.git +[submodule "bundle/vundle"] + path = bundle/vundle + url = git://github.com/gmarik/Vundle.vim.git diff --git a/README.md b/README.md index 54bd4f9..521d33e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ git clone http://github.com/FundingCircle/dotvim.git ~/.vim ln -s ~/.vim/vimrc ~/.vimrc cd ~/.vim/ && git submodule init && git submodule update +vi +:BundleInstall ``` ## Custom Commands diff --git a/bundle.vimrc b/bundle.vimrc new file mode 100644 index 0000000..bf36afd --- /dev/null +++ b/bundle.vimrc @@ -0,0 +1,24 @@ +set nocompatible +filetype off + +set rtp+=~/.vim/bundle/vundle +call vundle#begin() + +Plugin 'vim-scripts/ZoomWin' +Plugin 'vim-scripts/ack.vim' +Plugin 'epmatsw/ag.vim' +Plugin 'kien/ctrlp.vim' +Plugin 'claco/jasmine.vim' +Plugin 'scrooloose/nerdcommenter' +Plugin 'scrooloose/nerdtree' +Plugin 'vim-scripts/ruby-matchit' +Plugin 'ervandew/supertab' +Plugin 'scrooloose/syntastic' +Plugin 'tpope/vim-fugitive' +Plugin 'aghareza/vim-gitgrep' +Plugin 'tpope/vim-rails' +Plugin 'thoughtbot/vim-rspec' +Plugin 'tpope/vim-surround' +Plugin 'vim-scripts/vim-auto-save' +Plugin 'Pembear/vim-localvimrc' + diff --git a/bundle/ack b/bundle/ack deleted file mode 160000 index b9f85ef..0000000 --- a/bundle/ack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b9f85efc0dcc97cdafa8dcc1689e8a8d3f1dd756 diff --git a/bundle/ag b/bundle/ag deleted file mode 160000 index 36c4681..0000000 --- a/bundle/ag +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 36c4681665725426e380f4e77b6a94e1bb0cb61b diff --git a/bundle/auto-save b/bundle/auto-save deleted file mode 160000 index 6f9093e..0000000 --- a/bundle/auto-save +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f9093ee9049c7fbff6d7d2c3c095e9505a8b1b3 diff --git a/bundle/ctrlp b/bundle/ctrlp deleted file mode 160000 index b5d3fe6..0000000 --- a/bundle/ctrlp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f diff --git a/bundle/fugitive b/bundle/fugitive deleted file mode 160000 index c471320..0000000 --- a/bundle/fugitive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c4713200f76550f3f310fe7e176925d3f4ec1809 diff --git a/bundle/jasmine b/bundle/jasmine deleted file mode 160000 index 50cae13..0000000 --- a/bundle/jasmine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 50cae137f8308cdfdf70010232a852a364549411 diff --git a/bundle/kwbd b/bundle/kwbd deleted file mode 160000 index ed6d180..0000000 --- a/bundle/kwbd +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed6d180b44c93d6ed0dfdeeee81b74bc0a46c3cb diff --git a/bundle/localvimrc b/bundle/localvimrc deleted file mode 160000 index 3263745..0000000 --- a/bundle/localvimrc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 326374501cb03d717fdf89b1a8140cc1155e4ab2 diff --git a/bundle/nerdcommenter b/bundle/nerdcommenter deleted file mode 160000 index 0b3d928..0000000 --- a/bundle/nerdcommenter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0b3d928dce8262dedfc2f83b9aeb59a94e4f0ae4 diff --git a/bundle/nerdtree b/bundle/nerdtree deleted file mode 160000 index b0bb781..0000000 --- a/bundle/nerdtree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b0bb781fc73ef40365e4c996a16f04368d64fc9d diff --git a/bundle/rails b/bundle/rails deleted file mode 160000 index 98fe1d2..0000000 --- a/bundle/rails +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 98fe1d2abd325d29c608a60f1e8410d858a3e8e4 diff --git a/bundle/rspec b/bundle/rspec deleted file mode 160000 index 94a256b..0000000 --- a/bundle/rspec +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94a256b7e02f5056cab197d9b079901858737324 diff --git a/bundle/ruby-matchit b/bundle/ruby-matchit deleted file mode 160000 index c4d8079..0000000 --- a/bundle/ruby-matchit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c4d8079287fc8d804d2a92bcb66964d673666540 diff --git a/bundle/supertab b/bundle/supertab deleted file mode 160000 index 940885c..0000000 --- a/bundle/supertab +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 940885c872b6c2889604271dd613651d264f1c70 diff --git a/bundle/surround b/bundle/surround deleted file mode 160000 index f85cb4e..0000000 --- a/bundle/surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f85cb4e788356f664d033e8519abdd8e1bc26762 diff --git a/bundle/syntastic b/bundle/syntastic deleted file mode 160000 index 1383c0f..0000000 --- a/bundle/syntastic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1383c0f50a0d0330f0ba7035f0d7c40cbb671701 diff --git a/bundle/vundle b/bundle/vundle new file mode 160000 index 0000000..0b28e33 --- /dev/null +++ b/bundle/vundle @@ -0,0 +1 @@ +Subproject commit 0b28e334e65b6628b0a61c412fcb45204a2f2bab diff --git a/bundle/zoomwin b/bundle/zoomwin deleted file mode 160000 index cf21ce1..0000000 --- a/bundle/zoomwin +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cf21ce1f4bfec10fe7e446c08e9e647a2a234e03 diff --git a/internal.vimrc b/internal.vimrc new file mode 100644 index 0000000..970c550 --- /dev/null +++ b/internal.vimrc @@ -0,0 +1,197 @@ +set nocompatible + +execute pathogen#infect() +let mapleader = "," +color vividchalk +set guifont=monaco:h16 +let &t_Co=256 + +set cursorline +set hidden +set number +set ruler +set encoding=utf-8 +set backspace=indent,eol,start " Fix problems with backspace in insert mode +syntax on + +" Whitespace +set nowrap +set tabstop=2 +set shiftwidth=2 +set softtabstop=2 +set expandtab +set list listchars=tab:\ \ ,trail:· + +" Searching +set nohlsearch +set incsearch +set ignorecase +set smartcase + +" Tab completion +set wildmode=list:longest,list:full +set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* + +set laststatus=2 " Status bar +set showcmd " Display incomplete commands + +" Turn off backup files +set noswapfile +set nobackup +set nowb + +" Speed up +set ttyfast +set ttyscroll=3 +set lazyredraw + +set autoread " Reload files changed outside vim + +set autowrite " Automatically :write before running commands + +" Press i to enter insert mode, ii to go back to normal mode +imap ii + +" Copy current filename into system clipboard +nnoremap cf :let @* = expand("%:~") + +" Paste last contents of what was yanked regardless of what was deleted after +nnoremap p "0p +nnoremap P "0P + +" Copy to clipboard +vnoremap "*y + +" Vertical split and move to new window +nnoremap v vl + +" Horizontal split and move to new window +nnoremap h :splitj + +" Easier split navigation +nnoremap +nnoremap +nnoremap +nnoremap + +" Control-P +set runtimepath^=~/.vim/bundle/ctrlp.vim +set wildignore+=*/tmp/* +map b :CtrlPBuffer +map cpc :CtrlPClearCache + +" Make CtrlP use Ag for listing the files. Much faster and respects .gitignore +let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' + +" CtrlP auto cache clearing. +function! SetupCtrlP() + if exists("g:loaded_ctrlp") && g:loaded_ctrlp + augroup CtrlPExtension + autocmd! + autocmd FocusGained * CtrlPClearCache + autocmd BufWritePost * CtrlPClearCache + augroup END + endif +endfunction +if has("autocmd") + autocmd VimEnter * :call SetupCtrlP() +endif + +" NERDTree configuration +nnoremap :NERDTreeFind +let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$'] +map nt :NERDTreeToggle + +" ZoomWin configuration +map :ZoomWin + +" Delete buffer without closing window +nnoremap bd :Kwbd + +" enable AutoSave on Vim startup +let g:auto_save = 1 + +" CTags +map rt :!ctags --extra=+f --exclude=tmp --exclude=node_modules -R * + +" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing +let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'" + +" Remember last location in file +if has("autocmd") + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") + \| exe "normal g'\"" | endif +endif + +" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby +au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby + +" Add json syntax highlighting +au BufNewFile,BufRead *.json set ft=javascript + +" Add markdown syntax highlighting and spellcheck +au BufRead,BufNewFile *.md set ft=markdown +au BufRead,BufNewFile *.md setlocal spell +au BufRead,BufNewFile *.md setlocal wrap +map M :set syntax=markdown:set wrap:set spell + +" Load the plugin and indent settings for the detected filetype +filetype plugin indent on + +" Enable syntastic syntax checking +let g:syntastic_enable_signs=1 +let g:syntastic_quiet_messages = {'level': 'warnings'} + +" % to bounce from do to end etc. +runtime! macros/matchit.vim + +let g:miniBufExplMapWindowNavVim = 1 +let g:miniBufExplMapCTabSwitchBufs = 1 + +" Open up a git grep line, with a quote started for the search +nnoremap ag :Ag + +" Toggle pasting to preserve format when pasting from clipboard into buffer +nnoremap pt :set invpaste paste? +set pastetoggle=pt +set showmode + +" Run RSpec tests +let g:rspec_command = "!bundle exec rspec {spec}" +map t :call RunCurrentSpecFile() +map s :call RunNearestSpec() +map l :call RunLastSpec() +map z :!rspec % + +" Find the related spec for any file you open. Requires +" * Your specs live in spec/ or fast_spec/ +" * Your pwd (current dir) is the project root +" * You use the same dir structure in your code and specs so that +" code living at lib/foo/bar.rb has a spec at spec/lib/foo/bar.rb +" +" This method handles files in fast_spec unlike the :A and :AV functions +" that ship with rails.vim +function! FindSpec() + let s:fullpath = expand("%:p") + let s:filepath = expand("%:h") + let s:fname = expand("%:t") + + " Possible names for the spec/test for the file we're looking at + let s:test_names = [substitute(s:fname, ".rb$", "_spec.rb", ""), substitute(s:fname, ".rb$", "_test.rb", "")] + + " Possible paths + let s:test_paths = ["spec", "fast_spec", "test"] + for test_name in s:test_names + for path in s:test_paths + let s:filepath_without_app = substitute(s:filepath, "app/", "", "") + let s:spec_path = path . "/" . s:filepath_without_app . "/" . test_name + let s:full_spec_path = substitute(s:fullpath, s:filepath . "/" . s:fname, s:spec_path, "") + if filereadable(s:full_spec_path) + execute ":botright vsp " . s:full_spec_path + return + endif + endfor + endfor +endfunction + +map fs :call FindSpec() diff --git a/vimrc b/vimrc index bf2b75e..1d1b914 100644 --- a/vimrc +++ b/vimrc @@ -1,197 +1,2 @@ -set nocompatible - -execute pathogen#infect() -let mapleader = "," -color vividchalk -set guifont=monaco:h16 -let &t_Co=256 - -set cursorline -set hidden -set number -set ruler -set encoding=utf-8 -set backspace=indent,eol,start " Fix problems with backspace in insert mode -syntax on - -" Whitespace -set nowrap -set tabstop=2 -set shiftwidth=2 -set softtabstop=2 -set expandtab -set list listchars=tab:\ \ ,trail:· - -" Searching -set nohlsearch -set incsearch -set ignorecase -set smartcase - -" Tab completion -set wildmode=list:longest,list:full -set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* - -set laststatus=2 " Status bar -set showcmd " Display incomplete commands - -" Turn off backup files -set noswapfile -set nobackup -set nowb - -" Speed up -set ttyfast -set ttyscroll=3 -set lazyredraw - -set autoread " Reload files changed outside vim - -set autowrite " Automatically :write before running commands - -" Press i to enter insert mode, ii to go back to normal mode -imap ii - -" Copy current filename into system clipboard -nnoremap cf :let @* = expand("%:~") - -" Paste last contents of what was yanked regardless of what was deleted after -nnoremap p "0p -nnoremap P "0P - -" Copy to clipboard -vnoremap "*y - -" Vertical split and move to new window -nnoremap v vl - -" Horizontal split and move to new window -nnoremap h :splitj - -" Easier split navigation -nnoremap -nnoremap -nnoremap -nnoremap - -" Control-P -set runtimepath^=~/.vim/bundle/ctrlp.vim -set wildignore+=*/tmp/* -map b :CtrlPBuffer -map cpc :CtrlPClearCache - -" Make CtrlP use Ag for listing the files. Much faster and respects .gitignore -let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' - -" CtrlP auto cache clearing. -function! SetupCtrlP() - if exists("g:loaded_ctrlp") && g:loaded_ctrlp - augroup CtrlPExtension - autocmd! - autocmd FocusGained * CtrlPClearCache - autocmd BufWritePost * CtrlPClearCache - augroup END - endif -endfunction -if has("autocmd") - autocmd VimEnter * :call SetupCtrlP() -endif - -" NERDTree configuration -nnoremap :NERDTreeFind -let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$'] -map nt :NERDTreeToggle - -" ZoomWin configuration -map :ZoomWin - -" Delete buffer without closing window -nnoremap bd :Kwbd - -" enable AutoSave on Vim startup -let g:auto_save = 1 - -" CTags -map rt :!ctags --extra=+f --exclude=tmp --exclude=node_modules -R * - -" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing -let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'" - -" Remember last location in file -if has("autocmd") - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") - \| exe "normal g'\"" | endif -endif - -" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby -au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby - -" Add json syntax highlighting -au BufNewFile,BufRead *.json set ft=javascript - -" Add markdown syntax highlighting and spellcheck -au BufRead,BufNewFile *.md set ft=markdown -au BufRead,BufNewFile *.md setlocal spell -au BufRead,BufNewFile *.md setlocal wrap -map M :set syntax=markdown:set wrap:set spell - -" Load the plugin and indent settings for the detected filetype -filetype plugin indent on - -" Enable syntastic syntax checking -let g:syntastic_enable_signs=1 -let g:syntastic_quiet_messages = {'level': 'warnings'} - -" % to bounce from do to end etc. -runtime! macros/matchit.vim - -let g:miniBufExplMapWindowNavVim = 1 -let g:miniBufExplMapCTabSwitchBufs = 1 - -" Open up a git grep line, with a quote started for the search -nnoremap ag :Ag - -" Toggle pasting to preserve format when pasting from clipboard into buffer -nnoremap pt :set invpaste paste? -set pastetoggle=pt -set showmode - -" Run RSpec tests -let g:rspec_command = "!bundle exec rspec {spec}" -map t :call RunCurrentSpecFile() -map s :call RunNearestSpec() -map l :call RunLastSpec() -map z :!rspec % - -" Find the related spec for any file you open. Requires -" * Your specs live in spec/ or fast_spec/ -" * Your pwd (current dir) is the project root -" * You use the same dir structure in your code and specs so that -" code living at lib/foo/bar.rb has a spec at spec/lib/foo/bar.rb -" -" This method handles files in fast_spec unlike the :A and :AV functions -" that ship with rails.vim -function! FindSpec() - let s:fullpath = expand("%:p") - let s:filepath = expand("%:h") - let s:fname = expand("%:t") - - " Possible names for the spec/test for the file we're looking at - let s:test_names = [substitute(s:fname, ".rb$", "_spec.rb", ""), substitute(s:fname, ".rb$", "_test.rb", "")] - - " Possible paths - let s:test_paths = ["spec", "fast_spec", "test"] - for test_name in s:test_names - for path in s:test_paths - let s:filepath_without_app = substitute(s:filepath, "app/", "", "") - let s:spec_path = path . "/" . s:filepath_without_app . "/" . test_name - let s:full_spec_path = substitute(s:fullpath, s:filepath . "/" . s:fname, s:spec_path, "") - if filereadable(s:full_spec_path) - execute ":botright vsp " . s:full_spec_path - return - endif - endfor - endfor -endfunction - -map fs :call FindSpec() +source ~/.vim/bundle.vimrc +source ~/.vim/internal.vimrc