Mercurial > dotfiles
changeset 347:4d73159f56ca
Use pathogen as a sub-repo, plus a few Vim tweaks.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 14 Mar 2016 21:01:35 -0700 |
parents | 67e6ade3a451 |
children | 976988492a8f |
files | .hgsub .hgsubstate vim/autoload/pathogen.vim vim/vimrc |
diffstat | 4 files changed, 13 insertions(+), 240 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsub Sun Mar 13 15:48:31 2016 -0700 +++ b/.hgsub Mon Mar 14 21:01:35 2016 -0700 @@ -18,6 +18,8 @@ vim/bundle/vimroom = [git]https://github.com/mikewest/vimroom.git vim/bundle/solarized = [git]https://github.com/altercation/vim-colors-solarized.git vim/bundle/fugitive = [git]https://github.com/tpope/vim-fugitive.git +vim/bundle/pathogen = [git]https://github.com/tpope/vim-pathogen.git +vim/bundle/sleuth = [git]https://github.com/tpope/vim-sleuth.git vim/bundle/syntastic = [git]https://github.com/scrooloose/syntastic.git vim/bundle/less = [git]https://github.com/groenewege/vim-less.git vim/bundle/twig = [git]https://github.com/beyondwords/vim-twig.git
--- a/.hgsubstate Sun Mar 13 15:48:31 2016 -0700 +++ b/.hgsubstate Mon Mar 14 21:01:35 2016 -0700 @@ -18,7 +18,7 @@ 649120e90e92bc2ae5361693fa1e4dd2d02c1822 vim/bundle/easymotion 19d1c944dbf59f252135688018610a12ce5718b4 vim/bundle/fugitive 6577ac10e3249d48576a44732dd765650273eef1 vim/bundle/gundo -794ee111bce6f72d8c3c2dde7e5a0438e21f0d4c vim/bundle/gutentags +05fc1e2172ccab273a15305f8168526a0a7d065e vim/bundle/gutentags 1f2e47c78c2faf90ff419c2f4e1241094844678c vim/bundle/haml 09b5653761879394b24f6c902c7dbbbd11b19512 vim/bundle/interestingwords 8a8f0ed97c1751d304cf5b7241f2fe27b0e61f81 vim/bundle/jinja @@ -27,11 +27,13 @@ 0c60eb4de8827d762137e7d956219ee7f5b67494 vim/bundle/linediff 4260faa48f5b89261f1168d4a1ad195106f5959c vim/bundle/markdown 4ebbb533c3faf2c480211db2b547972bb3b60f2b vim/bundle/nerdtree +8c91196cfd9c8fe619f35fac6f2ac81be10677f8 vim/bundle/pathogen af8514b79c046a6bb447021b81351edb050ac69f vim/bundle/piecrust 114f8e5c204f1cac9b2443065910fa182de39fb8 vim/bundle/powerline 4bda3035ce9523a6d31792bc6c22ce2b9e0ae9a3 vim/bundle/pythonmode 0ef3f6a5778467fbca12b7874a4509593b209228 vim/bundle/ragtag 7a6675f092842c8f81e71d5345bd7cdbf3759415 vim/bundle/repeat +a17462708aa40a7fc0afd4effa559087d8a2c908 vim/bundle/sleuth 528a59f26d12278698bb946f8fb82a63711eec21 vim/bundle/solarized 66511772a430a5eaad7f7d03dbb02e8f33c4a641 vim/bundle/supertab 2d05440ad23f97a7874ebd9b5de3a0e65d25d85c vim/bundle/surround
--- a/vim/autoload/pathogen.vim Sun Mar 13 15:48:31 2016 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope <http://tpo.pe/> -" Version: 2.0 - -" Install in ~/.vim/autoload (or ~\vimfiles\autoload). -" -" For management of individually installed plugins in ~/.vim/bundle (or -" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc -" prior to `filetype plugin indent on` is the only other setup necessary. -" -" The API is documented inline below. For maximum ease of reading, -" :set foldmethod=marker - -if exists("g:loaded_pathogen") || &cp - finish -endif -let g:loaded_pathogen = 1 - -" Point of entry for basic default usage. Give a directory name to invoke -" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path -" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, -" pathogen#cycle_filetype() is invoked. -function! pathogen#infect(...) abort " {{{1 - let source_path = a:0 ? a:1 : 'bundle' - if source_path =~# '[\\/]' - call pathogen#runtime_prepend_subdirectories(source_path) - else - call pathogen#runtime_append_all_bundles(source_path) - endif - call pathogen#cycle_filetype() -endfunction " }}}1 - -" Split a path into a list. -function! pathogen#split(path) abort " {{{1 - if type(a:path) == type([]) | return a:path | endif - let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,') - return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")') -endfunction " }}}1 - -" Convert a list to a path. -function! pathogen#join(...) abort " {{{1 - if type(a:1) == type(1) && a:1 - let i = 1 - let space = ' ' - else - let i = 0 - let space = '' - endif - let path = "" - while i < a:0 - if type(a:000[i]) == type([]) - let list = a:000[i] - let j = 0 - while j < len(list) - let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g') - let path .= ',' . escaped - let j += 1 - endwhile - else - let path .= "," . a:000[i] - endif - let i += 1 - endwhile - return substitute(path,'^,','','') -endfunction " }}}1 - -" Convert a list to a path with escaped spaces for 'path', 'tag', etc. -function! pathogen#legacyjoin(...) abort " {{{1 - return call('pathogen#join',[1] + a:000) -endfunction " }}}1 - -" Remove duplicates from a list. -function! pathogen#uniq(list) abort " {{{1 - let i = 0 - let seen = {} - while i < len(a:list) - if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i]) - call remove(a:list,i) - elseif a:list[i] ==# '' - let i += 1 - let empty = 1 - else - let seen[a:list[i]] = 1 - let i += 1 - endif - endwhile - return a:list -endfunction " }}}1 - -" \ on Windows unless shellslash is set, / everywhere else. -function! pathogen#separator() abort " {{{1 - return !exists("+shellslash") || &shellslash ? '/' : '\' -endfunction " }}}1 - -" Convenience wrapper around glob() which returns a list. -function! pathogen#glob(pattern) abort " {{{1 - let files = split(glob(a:pattern),"\n") - return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")') -endfunction "}}}1 - -" Like pathogen#glob(), only limit the results to directories. -function! pathogen#glob_directories(pattern) abort " {{{1 - return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') -endfunction "}}}1 - -" Turn filetype detection off and back on again if it was already enabled. -function! pathogen#cycle_filetype() " {{{1 - if exists('g:did_load_filetypes') - filetype off - filetype on - endif -endfunction " }}}1 - -" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if -" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde. -function! pathogen#is_disabled(path) " {{{1 - if a:path =~# '\~$' - return 1 - elseif !exists("g:pathogen_disabled") - return 0 - endif - let sep = pathogen#separator() - return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1 -endfunction "}}}1 - -" Prepend all subdirectories of path to the rtp, and append all 'after' -" directories in those subdirectories. -function! pathogen#runtime_prepend_subdirectories(path) " {{{1 - let sep = pathogen#separator() - let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)') - let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])') - let rtp = pathogen#split(&rtp) - let path = expand(a:path) - call filter(rtp,'v:val[0:strlen(path)-1] !=# path') - let &rtp = pathogen#join(pathogen#uniq(before + rtp + after)) - return &rtp -endfunction " }}}1 - -" For each directory in rtp, check for a subdirectory named dir. If it -" exists, add all subdirectories of that subdirectory to the rtp, immediately -" after the original directory. If no argument is given, 'bundle' is used. -" Repeated calls with the same arguments are ignored. -function! pathogen#runtime_append_all_bundles(...) " {{{1 - let sep = pathogen#separator() - let name = a:0 ? a:1 : 'bundle' - if "\n".s:done_bundles =~# "\\M\n".name."\n" - return "" - endif - let s:done_bundles .= name . "\n" - let list = [] - for dir in pathogen#split(&rtp) - if dir =~# '\<after$' - let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir] - else - let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)') - endif - endfor - let &rtp = pathogen#join(pathogen#uniq(list)) - return 1 -endfunction - -let s:done_bundles = '' -" }}}1 - -" Invoke :helptags on all non-$VIM doc directories in runtimepath. -function! pathogen#helptags() " {{{1 - let sep = pathogen#separator() - for dir in pathogen#split(&rtp) - if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(glob(dir.sep.'doc'.sep.'*')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags')) - helptags `=dir.'/doc'` - endif - endfor -endfunction " }}}1 - -command! -bar Helptags :call pathogen#helptags() - -" Like findfile(), but hardcoded to use the runtimepath. -function! pathogen#runtime_findfile(file,count) "{{{1 - let rtp = pathogen#join(1,pathogen#split(&rtp)) - return fnamemodify(findfile(a:file,rtp,a:count),':p') -endfunction " }}}1 - -function! s:find(count,cmd,file,lcd) " {{{1 - let rtp = pathogen#join(1,pathogen#split(&runtimepath)) - let file = pathogen#runtime_findfile(a:file,a:count) - if file ==# '' - return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" - elseif a:lcd - let path = file[0:-strlen(a:file)-2] - execute 'lcd `=path`' - return a:cmd.' '.fnameescape(a:file) - else - return a:cmd.' '.fnameescape(file) - endif -endfunction " }}}1 - -function! s:Findcomplete(A,L,P) " {{{1 - let sep = pathogen#separator() - let cheats = { - \'a': 'autoload', - \'d': 'doc', - \'f': 'ftplugin', - \'i': 'indent', - \'p': 'plugin', - \'s': 'syntax'} - if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) - let request = cheats[a:A[0]].a:A[1:-1] - else - let request = a:A - endif - let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*' - let found = {} - for path in pathogen#split(&runtimepath) - let matches = split(glob(path.sep.pattern),"\n") - call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') - call map(matches,'v:val[strlen(path)+1:-1]') - for match in matches - let found[match] = 1 - endfor - endfor - return sort(keys(found)) -endfunction " }}}1 - -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1) - -" vim:set ft=vim ts=8 sw=2 sts=2:
--- a/vim/vimrc Sun Mar 13 15:48:31 2016 -0700 +++ b/vim/vimrc Mon Mar 14 21:01:35 2016 -0700 @@ -42,14 +42,15 @@ call add(g:pathogen_disabled, 'ragtag') call add(g:pathogen_disabled, 'interestingwords') +" Load pathogen. " Potentially add the local bundle directory. +let s:pathogen_bundles = ['bundle/{}'] if isdirectory(s:vim_home.s:path_sep.'local') - execute 'set runtimepath+='.s:vim_home.s:path_sep.'local' + "execute 'set runtimepath+='.s:vim_home.s:path_sep.'local' + call add(s:pathogen_bundles, 'local/{}') endif - -" Load pathogen. -"call pathogen#infect() -call pathogen#runtime_append_all_bundles() +call call('pathogen#infect', s:pathogen_bundles) +"call pathogen#runtime_append_all_bundles() " Hide the toolbar in MacVim/gVIM, and set a nice window size. if has("gui_running") && !exists('g:resourcing_vimrc') @@ -381,6 +382,7 @@ augroup VimRCFileType_c au! autocmd FileType c,c++,cpp setlocal foldmethod=syntax + autocmd FileType c,c++,cpp setlocal colorcolumn=120 augroup END augroup VimRCFileType_css @@ -480,7 +482,7 @@ nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr> " Simple way to close a buffer without closing the window. -nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> +nnoremap <leader>d :bprevious<cr>:bdelete #<cr> " Use sane regexes. nnoremap / /\v