mirror of
https://github.com/tpope/vim-pathogen.git
synced 2026-05-28 00:21:02 +02:00
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:
+8
-8
@@ -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
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user