From c636c19f6a46bd6cc1a4dd88406f2a79e162b07f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 23 May 2017 17:34:51 -0400 Subject: [PATCH] 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/{}')`. --- autoload/pathogen.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index 12b6b5b..91e1cb0 100644 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -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:[\\/]\)'