Prioritize static paths in infect

The arguments to infect are reversed so that the earlier arguments show
up earlier in the load path.  This results in a lot of unintuitive
behaviors and I generally consider it to have been a mistake.  To
mitigate this, try pulling out the static, absolute paths and applying
them first.  You almost always want this, as it enables the expected
nesting in `pathogen#infect('~/Code/vim/', 'bundle/{}')`.
This commit is contained in:
Tim Pope
2017-05-23 17:34:51 -04:00
parent 39964dd295
commit c636c19f6a
+5 -1
View File
@@ -30,7 +30,11 @@ function! pathogen#infect(...) abort
call add(paths, 'pack/{}/start/{}')
endif
endif
for path in paths
let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*[\/]$'
for path in filter(copy(paths), 'v:val =~# static')
call pathogen#surround(path)
endfor
for path in filter(copy(paths), 'v:val !~# static')
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*\%([{}*]\|[\\/]$\)'
call pathogen#surround(path)
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'