60 Commits

Author SHA1 Message Date
Tim Pope f195ac5e40 pathogen.vim 2.2
* Accept multiple arguments to pathogen#infect().
* Fix errors in deprecated methods.
2013-01-14 17:54:17 -05:00
Maksim Ryzhikov 1050a784cc Fix error in pathogen#runtime_append_all_bundles 2013-01-14 16:22:57 -05:00
Tim Pope 6cfc5e7759 Fix errors on attempt to warn
Closes #81.
2013-01-14 13:30:43 -05:00
Tim Pope 1b7f130f57 Revert "Point README at stable release"
This reverts commit 95c285e426.
2013-01-13 23:27:54 -05:00
Tim Pope 98659f0af7 Fix multiple arguments to pathogen#infect 2013-01-13 23:17:14 -05:00
Tim Pope a860d000e1 Reveal multiple arguments form of pathogen#infect 2013-01-13 23:09:15 -05:00
Tim Pope 92ca2e574b Accept multiple arguments to pathogen#infect() 2013-01-13 22:55:33 -05:00
Tim Pope 95c285e426 Point README at stable release 2013-01-13 21:06:33 -05:00
Tim Pope a04bd7a195 pathogen.vim 2.1
* Deprecate :Vopen commands in favor of scriptease.vim.
* Deprecate pathogen#infect() calls on paths without explicit globs.
* Introduce pathogen#incubate().
* Deprecate pathogen#runtime_append_all_bundles().
* Introduce pathogen#surround().
* Deprecate pathogen#runtime_prepend_subdirectories().
* Allow absolute paths in g:pathogen_disabled.
2013-01-13 20:27:34 -05:00
Tim Pope a1b2b09e6a Mention deprecation of runtime_prepend_subdirectories 2013-01-13 19:52:43 -05:00
Tim Pope a2f7e9b93f Change incubate to be consistent with surround 2013-01-13 19:45:39 -05:00
Tim Pope 6c741e636a Provide more actionable warnings 2013-01-13 19:17:00 -05:00
Tim Pope 0533e25018 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.
2013-01-13 18:27:30 -05:00
Tim Pope 268c6a06c4 Don't use underscored markdown headers
These can confuse the syntax highlighter, and the === version looks like
a conflict marker.
2013-01-13 18:26:49 -05:00
Tim Pope 40dcd3743b Treat infect("~/foo/") as infect("/foo/{}") 2013-01-13 17:46:54 -05:00
Tim Pope 34eff0f3e4 Allow executing multiple commands 2013-01-13 12:56:59 -05:00
Tim Pope 5c657cbe99 Fix :Helptags for globs in path 2013-01-12 03:04:10 -05:00
Tim Pope 619f9ed386 Recommend *, not {}
This looks less weird.  People who want to disable can look it up in the
docs.
2013-01-12 02:55:39 -05:00
Tim Pope f79f1bb82b Clarify difference between {} and * 2013-01-12 02:49:44 -05:00
Tim Pope 54f9afb244 Allow wildcards in pathogen#infect() 2013-01-12 02:48:26 -05:00
Tim Pope bb6c0b8f5b Add missing abort declarations 2013-01-12 02:42:44 -05:00
Tim Pope 5eafb23d9b Don't truncate non-existent directory 2013-01-12 02:27:10 -05:00
Tim Pope d10ce854fc Strip trailing slashes is pathogen#surround() 2013-01-11 23:39:37 -05:00
Tim Pope 34b4567be4 Fix missing fold marker 2013-01-11 23:39:37 -05:00
Tim Pope f467f117c1 Fix typo 2013-01-11 23:20:27 -05:00
Tim Pope 07e7b35aef Actually try things before you commit 2013-01-11 23:12:29 -05:00
Tim Pope 6aa1bbf839 Introduce pathogen#surround() 2013-01-11 22:48:57 -05:00
Tim Pope df8f1b0b30 Rename pathogen#runtime_append_all_bundles
Better a cute name than a verbose yet still cryptic one.
2013-01-11 22:17:03 -05:00
Tim Pope 1fde396c57 Allow/encourage infect paths ending in /{}
I want to break this API.
2013-01-11 22:00:15 -05:00
Tim Pope 5bcf824e21 Formally deprecate :Vopen family 2013-01-11 21:33:02 -05:00
Tim Pope c0dbda5258 Allow disabling absolute path 2013-01-11 19:10:22 -05:00
Tim Pope da1c3c08ed Plug sensible.vim 2013-01-06 14:03:44 -05:00
Tim Pope 532f0ca7d9 Change :call to :execute
I have some ideas about uses for this, such as returning :finish if an
environment variable tells us to skip the vimrc.
2013-01-06 14:03:24 -05:00
Tim Pope 47523d9bc0 Allow for :exe pathogen#infect()
Idea: Return 'finish' here if an environment variable says to skip the
rest of the vimrc.
2013-01-01 21:29:22 -05:00
Tim Pope 1b46b4f991 Remove advice around filetype on
Closes #80.
2012-12-20 09:35:21 -05:00
Tim Pope e5f413f480 Promote scriptease.vim 2012-12-10 20:33:51 -05:00
Tim Pope 49e6d62fb1 Don't override existing :Vedit commands
Guess what my next plugin is going to be.
2012-11-11 10:55:39 -05:00
Tim Pope 96b5726ef3 Drop wget from install instructions
Who's in the wget-but-not-curl boat, anyways?
2012-09-24 13:21:17 -04:00
Tim Pope 11e39a169a Simplify modeline 2012-08-01 15:27:49 -04:00
Tim Pope 5e3fdd3a8a Fix :Vopen tab complete of a/b on Windows
Closes #70.
2012-07-30 11:37:01 -04:00
Tim Pope 2f9fd6de08 Fix :V* commands when file isn't found 2012-07-28 10:55:32 -04:00
Tim Pope 09f2c3b7d3 Fix the URL that GitHub broke
Closes #61.
2012-05-01 20:41:34 -04:00
Alex Efros c9fb89dd6e Fix error in :Helptags
Error happens if ~/.vim/doc/ doesn't contain
any files, but contain some subdirectories.
2012-02-23 16:47:04 -05:00
Tim Pope ab64b4ddd0 Support :Vedit on versions prior to 7.1.299 2011-11-06 02:23:33 -05:00
Tim Pope 00ce0614f0 Don't choke on :Vopen 123.txt
Closes #49.
2011-10-20 02:31:44 -04:00
Tim Pope 4462567926 Fix count argument to :V commands 2011-10-20 02:30:12 -04:00
mattn 4676508001 Expand path in complete candidates 2011-10-20 02:23:05 -04:00
Jared Grippe 7701d82201 Fix typo 2011-09-25 02:26:55 -04:00
Daniel Bolton a32131ce19 Chain install commands; fix curl opts/output 2011-09-18 02:23:45 -04:00
Tim Pope af1361a446 Clarify copyright 2011-09-18 02:23:45 -04:00
Tim Pope 9631019a3e Really fix pathogen#uniq() with empty strings 2011-08-27 17:41:34 -04:00
Tim Pope fbd0cc7040 Account for empty item in pathogen#uniq() 2011-08-27 17:30:22 -04:00
Tim Pope cb9717bba1 Provide cross-platform way to load from submodule
Closes #39.
2011-08-25 20:45:34 -04:00
Tim Pope 82cc6d795e Fix typo 2011-08-21 21:39:23 -04:00
Tim Pope 7804dbd8d5 Document lcd behavior of V commands 2011-08-21 14:55:11 -04:00
Tim Pope 97c27be992 Automatic lcd on :Vsplit, etc. 2011-08-21 14:45:09 -04:00
Maciej Konieczny dc26353727 Typo 2011-08-18 16:16:33 -04:00
Tim Pope b8e184638f Grammar fix 2011-08-18 16:16:33 -04:00
Anton Petrov fb16afe738 Fix hardcoded shellslashes for helptags() 2011-08-17 16:34:30 -04:00
Tim Pope 1e0c2b4393 Rename rtpfindfile to be consistent 2011-08-13 12:24:37 -04:00
2 changed files with 196 additions and 133 deletions
+37 -72
View File
@@ -1,35 +1,29 @@
pathogen.vim # pathogen.vim
============
Manage your `'runtimepath'` with ease. In practical terms, pathogen.vim Manage your `'runtimepath'` with ease. In practical terms, pathogen.vim
makes it super easy to install plugins and runtime files in their own makes it super easy to install plugins and runtime files in their own
private directories. private directories.
Installation ## Installation
------------
Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste: Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste:
mkdir -p ~/.vim/autoload ~/.vim/bundle mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim \ curl -Sso ~/.vim/autoload/pathogen.vim \
> ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
If you don't have `curl`, use `wget -O -` instead. If you're using Windows, change all occurrences of `~/.vim` to `~\vimfiles`.
By the way, if you're using Windows, change all occurrences of `~/.vim` ## Runtime Path Manipulation
to `~\vimfiles`.
Runtime Path Manipulation
-------------------------
Add this to your vimrc: Add this to your vimrc:
call pathogen#infect() execute pathogen#infect()
If you're brand new to Vim and lacking a vimrc, `vim ~/.vimrc` and paste If you're brand new to Vim and lacking a vimrc, `vim ~/.vimrc` and paste
in the following super-minimal example: in the following super-minimal example:
call pathogen#infect() execute pathogen#infect()
syntax on syntax on
filetype plugin indent on filetype plugin indent on
@@ -38,22 +32,24 @@ under `~/.vim/bundle`, and they will be added to the `'runtimepath'`.
Observe: Observe:
cd ~/.vim/bundle cd ~/.vim/bundle
git clone git://github.com/tpope/vim-fugitive.git git clone git://github.com/tpope/vim-sensible.git
Now [fugitive.vim](https://github.com/tpope/vim-fugitive) is installed. Now [sensible.vim](https://github.com/tpope/vim-sensible) is installed.
If you really want to get crazy, you could set it up as a submodule in 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 whatever repository you keep your dot files in. I don't like to get
crazy. crazy.
If you don't like the directory name `bundle`, you can pass a different If you don't like the directory name `bundle`, you can pass a runtime relative
name as an argument: glob as an argument:
call pathogen#infect('stuff') execute pathogen#infect('stuff/{}')
You can also pass an entire path instead. I keep the plugins I maintain The `{}` indicates where the expansion should occur. Currently only a
under `~/src`, and this is how I add them: trailing `{}` is supported.
call 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('bundle/{}, '~/src/vim/bundle/{}')
Normally to generate documentation, Vim expects you to run `:helptags` Normally to generate documentation, Vim expects you to run `:helptags`
on each directory with documentation (e.g., `:helptags ~/.vim/doc`). on each directory with documentation (e.g., `:helptags ~/.vim/doc`).
@@ -67,54 +63,25 @@ and other comma-delimited path options in ways most people will never
need to do. If you're one of those edge cases, look at the source. need to do. If you're one of those edge cases, look at the source.
It's well documented. It's well documented.
Runtime File Editing ## Runtime File Editing
--------------------
As a guy who writes a lot of Vim script, I edit a lot of runtime files. `:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and
For example, when editing a PDF file like I do every day, I might notice `:Vread` have all moved to [scriptease.vim][]
something weird in the syntax highlighting and want to have a look:
:sp $VIMRUNTIME/syntax/pdf.vim [scriptease.vim]: https://github.com/tpope/vim-scriptease
Even the best case scenario with tab complete is painful: ## FAQ
:sp $VIMR<Tab>/synt<Tab>/pd<Tab>
The picture is even bleaker if the file in question sits in a
bundle. Enter the V family of commands. The V stands for Vimruntime
(work with me here).
:Vsp s/pd<Tab>
As you can see, not only does it eliminate the need to qualify the
runtime path being targeted, the tab completion is friendlier, allowing
you to expand multiple components at once. Here's me editing
pathogen.vim itself:
:Ve a/pat<Tab>
In the event of duplicate files, you can give a count to disambiguate.
Here's the full list of commands:
* `:Vedit`
* `:Vsplit`
* `:Vvsplit`
* `:Vtabedit`
* `:Vpedit`
* `:Vread`
There's also `:Vopen`, which is like `:Vedit` but does an `:lcd` to the
containing runtime directory first.
FAQ
---
> Can I put pathogen.vim in a submodule like all my other plugins? > Can I put pathogen.vim in a submodule like all my other plugins?
Sure, stick it under `~/.vim/bundle`, and prepend the following to your Sure, stick it under `~/.vim/bundle`, and prepend the following to your
vimrc: vimrc:
source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim runtime bundle/vim-pathogen/autoload/pathogen.vim
Or if your bundles are somewhere other than `~/.vim` (say, `~/src/vim`):
source ~/src/vim/bundle/vim-pathogen/autoload/pathogen.vim
> Will you accept these 14 pull requests adding a `.gitignore` for > Will you accept these 14 pull requests adding a `.gitignore` for
> `tags` so I don't see untracked changes in my dot files repository? > `tags` so I don't see untracked changes in my dot files repository?
@@ -136,16 +103,15 @@ If you really must use one:
:!mkdir ~/.vim/bundle/name :!mkdir ~/.vim/bundle/name
:UseVimball ~/.vim/bundle/name :UseVimball ~/.vim/bundle/name
Contributing ## Contributing
------------
If your [commit message sucks](http://stopwritingramblingcommitmessages.com/), If your [commit message sucks](http://stopwritingramblingcommitmessages.com/),
I'm not going to accept your pull request. I've explained very politely I'm not going to accept your pull request. I've explained very politely
dozens of times that dozens of times that
[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) [my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
are absolute rules on on my own repositories, so I may lack the energy are absolute rules on my own repositories, so I may lack the energy to
to explain it to you yet another time. And please, if I ask you to explain it to you yet another time. And please, if I ask you to change
change something, `git commit --amend`. something, `git commit --amend`.
Beyond that, don't be shy about asking before patching. What takes you Beyond that, don't be shy about asking before patching. What takes you
hours might take me minutes simply because I have both domain knowledge hours might take me minutes simply because I have both domain knowledge
@@ -154,8 +120,7 @@ it a symptom of mental illness. On the flip side, some ideas I'll
reject no matter how good the implementation is. "Send a patch" is an reject no matter how good the implementation is. "Send a patch" is an
edge case answer in my book. edge case answer in my book.
Self-Promotion ## Self-Promotion
--------------
Like pathogen.vim? Follow the repository on Like pathogen.vim? Follow the repository on
[GitHub](https://github.com/tpope/vim-pathogen) and vote for it on [GitHub](https://github.com/tpope/vim-pathogen) and vote for it on
@@ -164,7 +129,7 @@ you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
[Twitter](http://twitter.com/tpope) and [Twitter](http://twitter.com/tpope) and
[GitHub](https://github.com/tpope). [GitHub](https://github.com/tpope).
License ## License
-------
Distributable under the same terms as Vim itself. See `:help license`. Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.
+159 -61
View File
@@ -1,12 +1,12 @@
" pathogen.vim - path option manipulation " pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/> " Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.0 " Version: 2.2
" Install in ~/.vim/autoload (or ~\vimfiles\autoload). " Install in ~/.vim/autoload (or ~\vimfiles\autoload).
" "
" For management of individually installed plugins in ~/.vim/bundle (or " For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc " ~\vimfiles\bundle), adding `call pathogen#infect()` to the top of your
" prior to `fileype plugin indent on` is the only other setup necessary. " .vimrc is the only other setup necessary.
" "
" The API is documented inline below. For maximum ease of reading, " The API is documented inline below. For maximum ease of reading,
" :set foldmethod=marker " :set foldmethod=marker
@@ -16,18 +16,35 @@ if exists("g:loaded_pathogen") || &cp
endif endif
let g:loaded_pathogen = 1 let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a directory name to invoke function! s:warn(msg)
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path if &verbose
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, echohl WarningMsg
" pathogen#cycle_filetype() is invoked. echomsg a:msg
function! pathogen#infect(...) abort " {{{1 echohl NONE
let source_path = a:0 ? a:1 : 'bundle'
if source_path =~# '[\\/]'
call pathogen#runtime_prepend_subdirectories(source_path)
else
call pathogen#runtime_append_all_bundles(source_path)
endif endif
endfunction
" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke
" pathogen#surround(). For backwards compatibility purposes, a full path that
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
" instead.
function! pathogen#infect(...) abort " {{{1
for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}']
if path =~# '^[^\\/]\+$'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#incubate(path . '/{}')
elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$'
call pathogen#incubate(path)
elseif path =~# '[\\/]\%({}\|\*\)$'
call pathogen#surround(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
endif
endfor
call pathogen#cycle_filetype() call pathogen#cycle_filetype()
return ''
endfunction " }}}1 endfunction " }}}1
" Split a path into a list. " Split a path into a list.
@@ -74,8 +91,11 @@ function! pathogen#uniq(list) abort " {{{1
let i = 0 let i = 0
let seen = {} let seen = {}
while i < len(a:list) while i < len(a:list)
if has_key(seen,a:list[i]) if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i) call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else else
let seen[a:list[i]] = 1 let seen[a:list[i]] = 1
let i += 1 let i += 1
@@ -108,8 +128,9 @@ function! pathogen#cycle_filetype() " {{{1
endif endif
endfunction " }}}1 endfunction " }}}1
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if " Check if a bundle is disabled. A bundle is considered disabled if it ends
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde. " in a tilde or its basename or full name is included in the list
" g:pathogen_disabled.
function! pathogen#is_disabled(path) " {{{1 function! pathogen#is_disabled(path) " {{{1
if a:path =~# '\~$' if a:path =~# '\~$'
return 1 return 1
@@ -117,29 +138,48 @@ function! pathogen#is_disabled(path) " {{{1
return 0 return 0
endif endif
let sep = pathogen#separator() let sep = pathogen#separator()
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1 let blacklist = g:pathogen_disabled
return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1
endfunction "}}}1 endfunction "}}}1
" Prepend all subdirectories of path to the rtp, and append all 'after' " Prepend the given directory to the runtime path and append its corresponding
" directories in those subdirectories. " after directory. If the directory is already included, move it to the
function! pathogen#runtime_prepend_subdirectories(path) " {{{1 " outermost position. Wildcards are added as is. Ending a path in /{} causes
let sep = pathogen#separator() " all subdirectories to be added (except those in g:pathogen_disabled).
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)') function! pathogen#surround(path) abort " {{{1
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])') let sep = pathogen#separator()
let rtp = pathogen#split(&rtp) let rtp = pathogen#split(&rtp)
let path = expand(a:path) if a:path =~# '[\\/]{}$'
call filter(rtp,'v:val[0:strlen(path)-1] !=# path') let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after)) let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
else
let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
let before = [path]
let after = [path . sep . 'after']
call filter(rtp, 'index(before + after, v:val) == -1')
endif
let &rtp = pathogen#join(before, rtp, after)
return &rtp return &rtp
endfunction " }}}1 endfunction " }}}1
" For each directory in rtp, check for a subdirectory named dir. If it " Prepend all subdirectories of path to the rtp, and append all 'after'
" exists, add all subdirectories of that subdirectory to the rtp, immediately " directories in those subdirectories. Deprecated.
" after the original directory. If no argument is given, 'bundle' is used. function! pathogen#runtime_prepend_subdirectories(path) " {{{1
" Repeated calls with the same arguments are ignored. call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')')
function! pathogen#runtime_append_all_bundles(...) " {{{1 return pathogen#surround(a:path . pathogen#separator() . '{}')
endfunction " }}}1
" For each directory in the runtime path, add a second entry with the given
" argument appended. If the argument ends in '/{}', add a separate entry for
" each subdirectory. The default argument is 'bundle/{}', which means that
" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*,
" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on
" UNIX).
function! pathogen#incubate(...) abort " {{{1
let sep = pathogen#separator() let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle' let name = a:0 ? a:1 : 'bundle/{}'
if "\n".s:done_bundles =~# "\\M\n".name."\n" if "\n".s:done_bundles =~# "\\M\n".name."\n"
return "" return ""
endif endif
@@ -147,47 +187,104 @@ function! pathogen#runtime_append_all_bundles(...) " {{{1
let list = [] let list = []
for dir in pathogen#split(&rtp) for dir in pathogen#split(&rtp)
if dir =~# '\<after$' 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 += filter(pathogen#glob_directories(substitute(dir,'after$',name[0:-3],'').'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
else
let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
endif
else else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)') if name =~# '{}$'
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name[0:-3].'*[^~]'), '!pathogen#is_disabled(v:val)')
else
let list += [dir . sep . name, dir]
endif
endif endif
endfor endfor
let &rtp = pathogen#join(pathogen#uniq(list)) let &rtp = pathogen#join(pathogen#uniq(list))
return 1 return 1
endfunction " }}}1
" Deprecated alias for pathogen#incubate().
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
if a:0
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#incubate('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#incubate()')
endif
return call('pathogen#incubate', map(copy(a:000),'v:val . "/{}"'))
endfunction endfunction
let s:done_bundles = '' let s:done_bundles = ''
" }}}1 " }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath. " Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() " {{{1 function! pathogen#helptags() abort " {{{1
let sep = pathogen#separator() let sep = pathogen#separator()
for dir in pathogen#split(&rtp) for glob in pathogen#split(&rtp)
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.'/doc') == 2 && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags')) for dir in split(glob(glob), "\n")
helptags `=dir.'/doc'` if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
endif helptags `=dir.'/doc'`
endif
endfor
endfor endfor
endfunction " }}}1 endfunction " }}}1
command! -bar Helptags :call pathogen#helptags() command! -bar Helptags :call pathogen#helptags()
" Like findfile(), but hardcoded to use the runtimepath. " Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#rtpfindfile(file,count) "{{{1 function! pathogen#execute(...) abort " {{{1
let rtp = pathogen#join(1,pathogen#split(&rtp)) for command in a:000
return fnamemodify(findfile(a:file,rtp,a:count),':p') execute command
endfor
return ''
endfunction " }}}1 endfunction " }}}1
function! s:find(count,cmd,file,...) " {{{1 " Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort "{{{1
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction " }}}1
" Backport of fnameescape().
function! pathogen#fnameescape(string) abort " {{{1
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction " }}}1
if exists(':Vedit')
finish
endif
let s:vopen_warning = 0
function! s:find(count,cmd,file,lcd) " {{{1
let rtp = pathogen#join(1,pathogen#split(&runtimepath)) let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#rtpfindfile(a:file,a:count) let file = pathogen#runtime_findfile(a:file,a:count)
if file ==# '' if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
elseif a:0 endif
let path = file[0:-strlen(a:file)-2] if !s:vopen_warning
execute a:1.' `=path`' let s:vopen_warning = 1
return a:cmd.' '.fnameescape(a:file) let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
else else
return a:cmd.' '.fnameescape(file) let warning = ''
endif
if a:lcd
let path = file[0:-strlen(a:file)-2]
execute 'lcd `=path`'
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
else
return a:cmd.' '.pathogen#fnameescape(file) . warning
endif endif
endfunction " }}}1 endfunction " }}}1
@@ -205,12 +302,13 @@ function! s:Findcomplete(A,L,P) " {{{1
else else
let request = a:A let request = a:A
endif endif
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*' let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
let found = {} let found = {}
for path in pathogen#split(&runtimepath) for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n") let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'v:val[strlen(path)+1:-1]') call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches for match in matches
let found[match] = 1 let found[match] = 1
endfor endfor
@@ -218,13 +316,13 @@ function! s:Findcomplete(A,L,P) " {{{1
return sort(keys(found)) return sort(keys(found))
endfunction " }}}1 endfunction " }}}1
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read<bang>',<q-args>) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,'lcd') command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
" vim:set ft=vim ts=8 sw=2 sts=2: " vim:set et sw=2: