From 43080a1e5cf789d311b30a9b7c7497e70758da71 Mon Sep 17 00:00:00 2001 From: gmarik Date: Fri, 18 Nov 2011 00:36:14 -0600 Subject: [PATCH] ignore wildignore with expand/glob - closes #110 --- autoload/vundle.vim | 2 +- autoload/vundle/config.vim | 10 +++++----- autoload/vundle/installer.vim | 8 ++++---- autoload/vundle/scripts.vim | 4 ++-- test/vimrc | 7 ++++++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 632a5b2..096f7cc 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -36,7 +36,7 @@ endif func! vundle#rc(...) abort - let g:bundle_dir = len(a:000) > 0 ? expand(a:1) : expand('$HOME/.vim/bundle') + let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) let g:vundle_log = [] call vundle#config#init() endf diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index e8443c1..86756d2 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -69,17 +69,17 @@ func! s:rtp_add_a() endf func! s:rtp_rm(dir) abort - exec 'set rtp-='.fnameescape(expand(a:dir)) - exec 'set rtp-='.fnameescape(expand(a:dir.'/after')) + exec 'set rtp-='.fnameescape(expand(a:dir, 1)) + exec 'set rtp-='.fnameescape(expand(a:dir.'/after', 1)) endf func! s:rtp_add(dir) abort - exec 'set rtp^='.fnameescape(expand(a:dir)) - exec 'set rtp+='.fnameescape(expand(a:dir.'/after')) + exec 'set rtp^='.fnameescape(expand(a:dir, 1)) + exec 'set rtp+='.fnameescape(expand(a:dir.'/after', 1)) endf func! s:expand_path(path) abort - return simplify(expand(a:path)) + return simplify(expand(a:path, 1)) endf let s:bundle = {} diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 5fb371e..0fbea50 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -4,7 +4,7 @@ func! vundle#installer#new(bang, ...) abort \ map(copy(a:000), 'vundle#config#init_bundle(v:val, {})') let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec')) - call vundle#scripts#view('Installer',['" Installing bundles to '.expand(g:bundle_dir)], names + ['Helptags']) + call vundle#scripts#view('Installer',['" Installing bundles to '.expand(g:bundle_dir, 1)], names + ['Helptags']) call s:process(a:bang, (a:bang ? 'add!' : 'add')) @@ -125,7 +125,7 @@ endf func! vundle#installer#clean(bang) abort let bundle_dirs = map(copy(g:bundles), 'v:val.path()') - let all_dirs = split(globpath(g:bundle_dir, '*'), "\n") + let all_dirs = split(globpath(g:bundle_dir, '*', 1), "\n") let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') if empty(x_dirs) @@ -178,7 +178,7 @@ endf func! s:has_doc(rtp) abort return isdirectory(a:rtp.'/doc') \ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags')) - \ && !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x'))) + \ && !(empty(glob(a:rtp.'/doc/*.txt', 1)) && empty(glob(a:rtp.'/doc/*.??x', 1))) endf func! s:helptags(rtp) abort @@ -192,7 +192,7 @@ func! s:helptags(rtp) abort endf func! s:sync(bang, bundle) abort - let git_dir = expand(a:bundle.path().'/.git/') + let git_dir = expand(a:bundle.path().'/.git/', 1) if isdirectory(git_dir) if !(a:bang) | return 'todate' | endif let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index e814b85..ba84cd3 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -105,7 +105,7 @@ func! vundle#scripts#view(title, headers, results) endf func! s:fetch_scripts(to) - let scripts_dir = fnamemodify(expand(a:to), ":h") + let scripts_dir = fnamemodify(expand(a:to, 1), ":h") if !isdirectory(scripts_dir) call mkdir(scripts_dir, "p") endif @@ -134,7 +134,7 @@ func! s:fetch_scripts(to) endf func! s:load_scripts(bang) - let f = expand(g:bundle_dir.'/.vundle/script-names.vim-scripts.org.json') + let f = expand(g:bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1) if a:bang || !filereadable(f) if 0 != s:fetch_scripts(f) return [] diff --git a/test/vimrc b/test/vimrc index c51c567..ec717a8 100644 --- a/test/vimrc +++ b/test/vimrc @@ -5,7 +5,7 @@ let root = '/tmp/vundle_bundles/' let src = 'http://github.com/gmarik/vundle.git' " let src = '~/.vim/bundle/vundle/.git' -if !isdirectory(expand(root).'/vundle') +if !isdirectory(expand(root, 1).'/vundle') exec '!git clone '.src.' '.root.'/vundle' endif @@ -56,6 +56,11 @@ filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags set wildignore+=.git " should not break clone +set wildignore+=.git/* " should not break clone +set wildignore+=*/.git/* +" TODO: helptags fails with this +" set wildignore+=doc/* " should not break clone +" set wildignore+=*/doc/* " BundleInstall