diff --git a/README.markdown b/README.markdown index 2b4a5f8..e3f1f75 100644 --- a/README.markdown +++ b/README.markdown @@ -39,17 +39,17 @@ If you really want to get crazy, you could set it up as a submodule in whatever repository you keep your dot files in. I don't like to get crazy. -If you don't like the directory name `bundle`, you can pass a different -name as an argument: +If you don't like the directory name `bundle`, you can pass a runtime relative +glob as an argument: - execute pathogen#infect('stuff') + execute pathogen#infect('stuff/{}') -You can also pass an absolute path instead, if you append `/*` to it. (This -is special cased for backwards compatiblity, but future versions will allow -any arbitrary glob.) I keep the plugins I maintain under `~/src`, and this is -how I add them: +The `{}` indicates where the expansion should occur. Currently only a +trailing `{}` is supported. - execute pathogen#infect('~/src/vim/bundle/*') +You can also pass an absolute path instead. I keep the plugins I maintain under `~/src`, and this is how I add them: + + execute pathogen#infect('~/src/vim/bundle/{}') Normally to generate documentation, Vim expects you to run `:helptags` on each directory with documentation (e.g., `:helptags ~/.vim/doc`). diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index 58a9749..c24921c 100644 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -23,19 +23,19 @@ let g:loaded_pathogen = 1 " instead. function! pathogen#infect(...) abort " {{{1 let source_path = a:0 ? a:1 : 'bundle' - if source_path =~# '[\\/]\%({}\|\*\)$' + if source_path =~# '^[^\\/]\+\%([\\/]\%({}\|\*\)\=\)\=$' + call pathogen#incubate(source_path) + elseif source_path =~# '[\\/]\%({}\|\*\)$' call pathogen#surround(source_path) elseif source_path =~# '[\\/]$' call pathogen#surround(source_path . '{}') - elseif source_path =~# '[\\/]' + else if &verbose echohl WarningMsg echomsg 'pathogen#infect() will soon require a trailing "/{}" to absolute paths' echohl NONE endif call pathogen#surround(source_path.'/{}') - else - call pathogen#incubate(source_path) endif call pathogen#cycle_filetype() return '' @@ -175,7 +175,7 @@ endfunction " }}}1 " Repeated calls with the same arguments are ignored. function! pathogen#incubate(...) abort " {{{1 let sep = pathogen#separator() - let name = a:0 ? a:1 : 'bundle' + let name = a:0 ? substitute(a:1, '[\\/]\%({}\)\=$', '', '') : 'bundle' if "\n".s:done_bundles =~# "\\M\n".name."\n" return "" endif @@ -183,9 +183,17 @@ function! pathogen#incubate(...) abort " {{{1 let list = [] for dir in pathogen#split(&rtp) if dir =~# '\