Allow incubate('bundle/{}')

I don't know if this is going to be a supported API, but since this is a
transitional release, let's keep our options open.
This commit is contained in:
Tim Pope
2013-01-13 18:08:12 -05:00
parent 268c6a06c4
commit 0533e25018
2 changed files with 23 additions and 15 deletions
+8 -8
View File
@@ -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`).
+15 -7
View File
@@ -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 =~# '\<after$'
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
if name =~# '*'
let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
else
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
endif
else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
if name =~# '*'
let list += [dir . sep . name, dir]
else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
endif
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))