From e2f96ded89af81e39cae04773f3e1bcc54e145e6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 21 Dec 2015 20:31:13 -0500 Subject: [PATCH] Experimental: Support "vimfiles" subdirectory In hindsight, I think dumping runtime files and directories directly into the root of the repository was a mistake, as it mixes them in with cruft like .gitignore and the README, not to mention not to mention unrelated files in repos with a purpose other than just Vim runtime files. Admittedly, transitioning to an alternate structure at this late stage is unlikely, but I'm adding preliminary support for it anyways as a hedge. The name "vimfiles" is used by Vim itself in a few places and in my opinion is the only name worth considering. I think enabling plugins to choose their own subdirectory would just add unnecessary configuration and overhead. --- autoload/pathogen.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index d9bd65e..76365f1 100644 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -178,16 +178,18 @@ function! pathogen#expand(pattern, ...) abort let found = map(split(pat, ',', 1), 'pre.v:val.post') let results = [] for pattern in found - call extend(results, call('pathogen#expand', [pattern] + a:000)) + call extend(results, pathogen#expand(pattern)) endfor elseif a:pattern =~# '{}' let pat = matchstr(a:pattern.after, '^.*{}[^*]*\%($\|[\\/]\)') - let post = (a:pattern.after)[strlen(pat) : -1] + let post = a:pattern[strlen(pat) : -1] let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') else - let results = [a:pattern.after] + let results = [a:pattern] endif - return results + let vf = pathogen#slash() . 'vimfiles' + call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""') + return filter(results, '!empty(v:val)') endfunction " \ on Windows unless shellslash is set, / everywhere else.