40 Commits

Author SHA1 Message Date
Tim Pope ac4dd9494f Remove foldexpr from modeline
Resolves: https://github.com/tpope/vim-pathogen/pull/223
2022-08-24 13:21:07 -04:00
Geraint Edwards e0a3efbda5 Fix whitespace needed around colon-separated slice args 2021-01-04 12:35:31 -05:00
othree c6bc424045 Create LICENSE 2020-01-17 11:19:31 -05:00
Tim Pope a553410f1b Add sponsor button 2019-11-12 18:41:01 -05:00
Tim Pope e9fb0914db Soften deprecation warning to dampen chicken little reaction 2018-12-13 15:00:59 -05:00
Tim Pope 24f5cdd805 Add a deprecation notice 2018-12-12 10:38:22 -05:00
Tim Pope 06da921608 Fix confusing negative in contribution guidelines 2018-04-05 17:59:57 -04:00
Tim Pope f4fd6044e3 Rewrite contribution guidelines 2018-03-14 17:27:36 -04:00
Tim Pope e7857bed4e Avoid line continuations for 'compatible' interop 2017-08-04 19:36:41 -04:00
Tim Pope ddfb1f14d7 Document native package management support 2017-05-27 14:48:52 -04:00
Tim Pope 17f6f4d585 Drop deprecated API 2017-05-27 14:38:29 -04:00
Tim Pope 3ec671e112 Always skip pack/{}/start/{} when has('packages')
This lets you explicitly pass the path in for backwards compatibility
without worrying about the Vim version.
2017-05-23 17:45:54 -04:00
Tim Pope c636c19f6a 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/{}')`.
2017-05-23 17:34:51 -04:00
Tim Pope 39964dd295 Allow trailing slash to override {} deprecation check 2017-05-22 16:52:30 -04:00
Tim Pope 6655e33627 Expand tilde to home directory 2017-05-22 16:24:29 -04:00
Tim Pope 379b8f7082 Backport Vim packages support 2017-05-22 15:47:34 -04:00
Anhad Jai Singh 0f4710063e Minor change in install instructions in README
Clarify that the commands for installation are to be copy and pasted
into the terminal and not into their ~/.vimrc or something else.

Prompted by a user in #vim asking where he should paste the commands for
installation.
2017-05-03 10:49:49 -04:00
Tim Pope 020ab25c38 Remove :V commands for good
Closes https://github.com/tpope/vim-pathogen/issues/178
2017-02-13 16:16:56 -05:00
Santhosh Kumar Srinivasan 7ba2e1b67a Use https:// instead of git:// while cloning (#180)
Fixes #179
2016-10-13 11:17:15 -04:00
Tim Pope 8c91196cfd Fix path expansion issue on Windows
References https://github.com/tpope/vim-pathogen/issues/83
2016-01-26 14:10:25 -05:00
Tim Pope b4f20ff0ac Work around hang on very old Vim
Closes https://github.com/tpope/vim-pathogen/issues/136
2016-01-19 20:13:29 -05:00
Tim Pope 84a3dd0d81 Drop :Vedit 2015-12-25 19:56:20 -05:00
Tim Pope 4d584ea8c8 pathogen.vim 2.4
* Use $VIMBLACKLIST to temporarily disable bundles.
* Allow disabling rest of vimrc by adding it to blacklist.
* Expand bundle/{a,b} as bundle/a and bundle/b.
* Experimental: Support "vimfiles" subdirectory.
* Work around weird lockup on ancient Vim.
* Restore disabling of paths ending in ~.
2015-12-25 19:06:34 -05:00
Tim Pope 8b27115203 Update instructions for disabling bundle 2015-12-25 19:06:06 -05:00
Tim Pope 890e013d96 Fix handling of after directories
Closes https://github.com/tpope/vim-pathogen/issues/167
2015-12-22 12:35:35 -05:00
Tim Pope 68ead6af17 Remove old fold markers 2015-12-21 20:33:12 -05:00
Tim Pope e2f96ded89 Experimental: Support "vimfiles" subdirectory
In hindsight, I think dumping runtime files and directories directly
into the root of the repository was a mistake, as it mixes them in with
cruft like .gitignore and the README, not to mention not to mention
unrelated files in repos with a purpose other than just Vim runtime
files.  Admittedly, transitioning to an alternate structure at this late
stage is unlikely, but I'm adding preliminary support for it anyways as
a hedge.

The name "vimfiles" is used by Vim itself in a few places and in my
opinion is the only name worth considering.  I think enabling plugins to
choose their own subdirectory would just add unnecessary configuration
and overhead.
2015-12-21 20:31:13 -05:00
Tim Pope a6004fd531 Separate "after" parameter during expansion 2015-12-21 18:35:24 -05:00
Lifepillar b4174e4d1a Fix typo in pathogen#surround()
Closes https://github.com/tpope/vim-pathogen/issues/157
2015-09-20 15:25:20 -04:00
Tim Pope b9fb0dfd81 Drop obsolete caveat about {} 2014-11-06 13:41:58 -05:00
Tim Pope 91e6378908 Strip trailing slashes in blacklist 2014-07-19 23:20:27 -04:00
koalaman ed01fca95c Update install commands to use && instead of ;
This way, if mkdir or cd fails, it'll stop rather than continuing to
download or clone in the wrong directory.
2014-05-29 17:45:08 -04:00
Tim Pope 1b644bf4b2 Take control of download URL
There have been multiple reports of failure with the existing URL,
though I can't reproduce.

Closes #128.
2014-05-26 20:44:16 -04:00
Tim Pope 336611a3d0 Fix curl command to support GitHub's new redirect
Closes #120.
2014-04-25 17:28:22 -04:00
Tim Pope bff90d72a1 Work around weird lockup on ancient Vim
Closes #118.
2014-04-01 23:42:58 -04:00
Tim Pope 099b918141 Expand bundle/{a,b} as bundle/a and bundle/b 2014-03-26 13:37:29 -04:00
Tim Pope 5b5bee9c44 Restore disabling of paths ending in ~ 2014-03-25 10:46:35 -04:00
Tim Pope 9a40364c60 Use $VIMBLACKLIST to temporarily disable bundles
VIMBLACKLIST=vim-fugitive,vim-dispatch vim
2014-03-24 12:17:15 -04:00
Tim Pope e1687eb4d9 Allow disabling rest of vimrc 2014-03-23 19:49:18 -04:00
Tim Pope f66e6f483f Try a fold expression 2014-03-21 16:27:00 -04:00
5 changed files with 225 additions and 196 deletions
+2
View File
@@ -0,0 +1,2 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]
+17 -13
View File
@@ -1,14 +1,18 @@
If your [commit message sucks](http://stopwritingramblingcommitmessages.com/), Follow the commit message guidelines at [commit.style](https://commit.style).
I'm not going to accept your pull request. I've explained very politely This is an absolute requirement for my repositories, and doing so proves you
dozens of times that actually read the contribution guidelines, which makes for a good first
[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) impression.
are absolute rules on my own repositories, so I may lack the energy to
explain it to you yet another time. And please, if I ask you to change
something, `git commit --amend`.
Beyond that, don't be shy about asking before patching. What takes you Good commit messages imply good commits. Pull requests should typically be a
hours might take me minutes simply because I have both domain knowledge single commit, or for the rare complicated case, a series of atomic commits.
and a perverse knowledge of Vim script so vast that many would consider If I request a change, use `git commit --amend` or `git rebase --interactive`
it a symptom of mental illness. On the flip side, some ideas I'll and force push to your branch.
reject no matter how good the implementation is. "Send a patch" is an
edge case answer in my book. For feature requests, don't be shy about proposing it in an issue before
drafting a patch. If it's a great idea, I might do it for you. If it's a
terrible idea, no patch will change my mind.
The worst ideas are configuration options. You'll need to provide a great
justification in order to persuade me to take on the maintenance and support
burden it will inevitably entail. See if you can get away with a custom map
or autocommand instead.
+81
View File
@@ -0,0 +1,81 @@
VIM LICENSE
I) There are no restrictions on distributing unmodified copies of
pathogen.vim except that they must include this license text. You can
also distribute unmodified parts of pathogen.vim, likewise unrestricted
except that they must include this license text. You are also allowed to
include executables that you made from the unmodified pathogen.vim
sources, plus your own usage examples and Vim scripts.
II) It is allowed to distribute a modified (or extended) version of
pathogen.vim, including executables and/or source code, when the following
four conditions are met:
1) This license text must be included unmodified.
2) The modified pathogen.vim must be distributed in one of the following
five ways:
a) If you make changes to pathogen.vim yourself, you must clearly
describe in the distribution how to contact you. When the
maintainer asks you (in any way) for a copy of the modified
pathogen.vim you distributed, you must make your changes, including
source code, available to the maintainer without fee. The
maintainer reserves the right to include your changes in the
official version of pathogen.vim. What the maintainer will do with
your changes and under what license they will be distributed is
negotiable. If there has been no negotiation then this license, or
a later version, also applies to your changes. The current
maintainer is Bram Moolenaar <Bram@vim.org>. If this changes it
will be announced in appropriate places (most likely vim.sf.net,
www.vim.org and/or comp.editors). When it is completely impossible
to contact the maintainer, the obligation to send him your changes
ceases. Once the maintainer has confirmed that he has received your
changes they will not have to be sent again.
b) If you have received a modified pathogen.vim that was distributed as
mentioned under a) you are allowed to further distribute it
unmodified, as mentioned at I). If you make additional changes the
text under a) applies to those changes.
c) Provide all the changes, including source code, with every copy of
the modified pathogen.vim you distribute. This may be done in the
form of a context diff. You can choose what license to use for new
code you add. The changes and their license must not restrict
others from making their own changes to the official version of
pathogen.vim.
d) When you have a modified pathogen.vim which includes changes as
mentioned under c), you can distribute it without the source code
for the changes if the following three conditions are met:
- The license that applies to the changes permits you to distribute
the changes to the Vim maintainer without fee or restriction, and
permits the Vim maintainer to include the changes in the official
version of pathogen.vim without fee or restriction.
- You keep the changes for at least three years after last
distributing the corresponding modified pathogen.vim. When the
maintainer or someone who you distributed the modified
pathogen.vim to asks you (in any way) for the changes within this
period, you must make them available to him.
- You clearly describe in the distribution how to contact you. This
contact information must remain valid for at least three years
after last distributing the corresponding modified pathogen.vim,
or as long as possible.
e) When the GNU General Public License (GPL) applies to the changes,
you can distribute the modified pathogen.vim under the GNU GPL
version 2 or any later version.
3) A message must be added, at least in the output of the ":version"
command and in the intro screen, such that the user of the modified
pathogen.vim is able to see that it was modified. When distributing as
mentioned under 2)e) adding the message is only required for as far as
this does not conflict with the license used for the changes.
4) The contact information as required under 2)a) and 2)d) must not be
removed or changed, except that the person himself can make
corrections.
III) If you distribute a modified version of pathogen.vim, you are encouraged
to use the Vim license for your changes and make them available to the
maintainer, including the source code. The preferred way to do this is
by e-mail or by uploading the files to a server and e-mailing the URL. If
the number of changes is small (e.g., a modified Makefile) e-mailing a
context diff will do. The e-mail address to be used is
<maintainer@vim.org>
IV) It is not allowed to remove this license from the distribution of the
pathogen.vim sources, parts of it or from a modified version. You may
use this license for previous pathogen.vim releases instead of the
license that they came with, at your option.
+18 -8
View File
@@ -4,13 +4,16 @@ 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.
**For new users, I recommend using Vim's built-in package management
instead.** `:help packages`
## Installation ## Installation
Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste: Install to `~/.vim/autoload/pathogen.vim`.
Or copy and paste the following into your terminal/shell:
mkdir -p ~/.vim/autoload ~/.vim/bundle; \ mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -Sso ~/.vim/autoload/pathogen.vim \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
If you're using Windows, change all occurrences of `~/.vim` to `~\vimfiles`. If you're using Windows, change all occurrences of `~/.vim` to `~\vimfiles`.
@@ -31,8 +34,8 @@ Now any plugins you wish to install can be extracted to a subdirectory
under `~/.vim/bundle`, and they will be added to the `'runtimepath'`. 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-sensible.git git clone https://github.com/tpope/vim-sensible.git
Now [sensible.vim](https://github.com/tpope/vim-sensible) 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
@@ -44,8 +47,7 @@ glob as an argument:
execute pathogen#infect('stuff/{}') execute pathogen#infect('stuff/{}')
The `{}` indicates where the expansion should occur. Currently only a The `{}` indicates where the expansion should occur.
trailing `{}` is supported.
You can also pass an absolute path instead. I keep the plugins I maintain under `~/src`, and this is how I add them: You can also pass an absolute path instead. I keep the plugins I maintain under `~/src`, and this is how I add them:
@@ -63,6 +65,14 @@ 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.
## Native Vim Package Management
Vim 8 includes support for package management in a manner similar to
pathogen.vim. If you'd like to transition to this native support,
pathogen.vim can help. Calling `pathogen#infect()` on an older version of Vim
will supplement the `bundle/{}` default with `pack/{}/start/{}`, effectively
backporting a subset of the new native functionality.
## Runtime File Editing ## Runtime File Editing
`:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and `:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and
+107 -175
View File
@@ -1,6 +1,6 @@
" pathogen.vim - path option manipulation " pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/> " Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.3 " Version: 2.4
" Install in ~/.vim/autoload (or ~\vimfiles\autoload). " Install in ~/.vim/autoload (or ~\vimfiles\autoload).
" "
@@ -8,8 +8,7 @@
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc 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.
" :set foldmethod=marker
if exists("g:loaded_pathogen") || &cp if exists("g:loaded_pathogen") || &cp
finish finish
@@ -17,37 +16,48 @@ endif
let g:loaded_pathogen = 1 let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a relative path to invoke " Point of entry for basic default usage. Give a relative path to invoke
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke " pathogen#interpose() or an absolute path to invoke pathogen#surround().
" pathogen#surround(). For backwards compatibility purposes, a full path that " Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories() " subdirectories inside "bundle" inside all directories in the runtime path.
" instead. " If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
function! pathogen#infect(...) abort " {{{1 " on versions of Vim without native package support.
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] function! pathogen#infect(...) abort
if path =~# '^[^\\/]\+$' if a:0
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
call pathogen#interpose(path . '/{}') else
elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$' let paths = ['bundle/{}', 'pack/{}/start/{}']
call pathogen#interpose(path) endif
elseif path =~# '[\\/]\%({}\|\*\)$' if has('packages')
call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
endif
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) call pathogen#surround(path)
else else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') call pathogen#interpose(path)
call pathogen#surround(path . '/{}')
endif endif
endfor endfor
call pathogen#cycle_filetype() call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return '' return ''
endfunction " }}}1 endfunction
" Split a path into a list. " Split a path into a list.
function! pathogen#split(path) abort " {{{1 function! pathogen#split(path) abort
if type(a:path) == type([]) | return a:path | endif if type(a:path) == type([]) | return a:path | endif
if empty(a:path) | return [] | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,') let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")') return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1 endfunction
" Convert a list to a path. " Convert a list to a path.
function! pathogen#join(...) abort " {{{1 function! pathogen#join(...) abort
if type(a:1) == type(1) && a:1 if type(a:1) == type(1) && a:1
let i = 1 let i = 1
let space = ' ' let space = ' '
@@ -71,55 +81,52 @@ function! pathogen#join(...) abort " {{{1
let i += 1 let i += 1
endwhile endwhile
return substitute(path,'^,','','') return substitute(path,'^,','','')
endfunction " }}}1 endfunction
" Convert a list to a path with escaped spaces for 'path', 'tag', etc. " Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1 function! pathogen#legacyjoin(...) abort
return call('pathogen#join',[1] + a:000) return call('pathogen#join',[1] + a:000)
endfunction " }}}1 endfunction
" Turn filetype detection off and back on again if it was already enabled. " Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() " {{{1 function! pathogen#cycle_filetype() abort
if exists('g:did_load_filetypes') if exists('g:did_load_filetypes')
filetype off filetype off
filetype on filetype on
endif endif
endfunction " }}}1 endfunction
" Check if a bundle is disabled. A bundle is considered disabled if its " Check if a bundle is disabled. A bundle is considered disabled if its
" basename or full name is included in the list g:pathogen_disabled. " basename or full name is included in the list g:pathogen_blacklist or the
function! pathogen#is_disabled(path) abort " {{{1 " comma delimited environment variable $VIMBLACKLIST.
function! pathogen#is_disabled(path) abort
if a:path =~# '\~$'
return 1
endif
let sep = pathogen#slash() let sep = pathogen#slash()
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
if !empty(blacklist)
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
endif
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
endfunction "}}}1 endfunction
" Prepend the given directory to the runtime path and append its corresponding " Prepend the given directory to the runtime path and append its corresponding
" after directory. If the directory is already included, move it to the " after directory. Curly braces are expanded with pathogen#expand().
" outermost position. Wildcards are added as is. Ending a path in /{} causes function! pathogen#surround(path) abort
" all subdirectories to be added (except those in g:pathogen_disabled).
function! pathogen#surround(path) abort " {{{1
let sep = pathogen#slash() let sep = pathogen#slash()
let rtp = pathogen#split(&rtp) let rtp = pathogen#split(&rtp)
if a:path =~# '[\\/]{}$' let path = fnamemodify(a:path, ':s?[\\/]\=$??')
let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??') let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)') let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0 : -7])')
let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])') call filter(rtp, 'index(before + after, v:val) == -1')
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) let &rtp = pathogen#join(before, rtp, after)
return &rtp return &rtp
endfunction " }}}1 endfunction
" For each directory in the runtime path, add a second entry with the given " 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 " argument appended. Curly braces are expanded with pathogen#expand().
" each subdirectory. function! pathogen#interpose(name) abort
function! pathogen#interpose(name) abort " {{{1
let sep = pathogen#slash() let sep = pathogen#slash()
let name = a:name let name = a:name
if has_key(s:done_bundles, name) if has_key(s:done_bundles, name)
@@ -129,17 +136,9 @@ function! pathogen#interpose(name) abort " {{{1
let list = [] let list = []
for dir in pathogen#split(&rtp) for dir in pathogen#split(&rtp)
if dir =~# '\<after$' if dir =~# '\<after$'
if name =~# '{}$' let list += reverse(filter(pathogen#expand(dir[0 : -6].name, sep.'after'), '!pathogen#is_disabled(v:val[0 : -7])')) + [dir]
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
if name =~# '{}$' let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
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))
@@ -148,10 +147,8 @@ endfunction
let s:done_bundles = {} let s:done_bundles = {}
" }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath. " Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort " {{{1 function! pathogen#helptags() abort
let sep = pathogen#slash() let sep = pathogen#slash()
for glob in pathogen#split(&rtp) for glob in pathogen#split(&rtp)
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep') for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
@@ -160,42 +157,72 @@ function! pathogen#helptags() abort " {{{1
endif endif
endfor endfor
endfor endfor
endfunction " }}}1 endfunction
command! -bar Helptags :call pathogen#helptags() command! -bar Helptags :call pathogen#helptags()
" Execute the given command. This is basically a backdoor for --remote-expr. " Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort " {{{1 function! pathogen#execute(...) abort
for command in a:000 for command in a:000
execute command execute command
endfor endfor
return '' return ''
endfunction " }}}1 endfunction
" Section: Unofficial " Section: Unofficial
" \ on Windows unless shellslash is set, / everywhere else. function! pathogen#is_absolute(path) abort
function! pathogen#slash() abort " {{{1 return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
return !exists("+shellslash") || &shellslash ? '/' : '\' endfunction
endfunction " }}}1
function! pathogen#separator() abort " {{{1 " Given a string, returns all possible permutations of comma delimited braced
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern, ...) abort
let after = a:0 ? a:1 : ''
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
if pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
let found = map(split(pat, ',', 1), 'pre.v:val.post')
let results = []
for pattern in found
call extend(results, pathogen#expand(pattern))
endfor
elseif pattern =~# '{}'
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = pattern[strlen(pat) : -1]
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
else
let results = [pattern]
endif
let vf = pathogen#slash() . 'vimfiles'
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
return filter(results, '!empty(v:val)')
endfunction
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction
function! pathogen#separator() abort
return pathogen#slash() return pathogen#slash()
endfunction " }}}1 endfunction
" Convenience wrapper around glob() which returns a list. " Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1 function! pathogen#glob(pattern) abort
let files = split(glob(a:pattern),"\n") let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")') return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
endfunction "}}}1 endfunction
" Like pathogen#glob(), only limit the results to directories. " Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1 function! pathogen#glob_directories(pattern) abort
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1 endfunction
" Remove duplicates from a list. " Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1 function! pathogen#uniq(list) abort
let i = 0 let i = 0
let seen = {} let seen = {}
while i < len(a:list) while i < len(a:list)
@@ -210,10 +237,10 @@ function! pathogen#uniq(list) abort " {{{1
endif endif
endwhile endwhile
return a:list return a:list
endfunction " }}}1 endfunction
" Backport of fnameescape(). " Backport of fnameescape().
function! pathogen#fnameescape(string) abort " {{{1 function! pathogen#fnameescape(string) abort
if exists('*fnameescape') if exists('*fnameescape')
return fnameescape(a:string) return fnameescape(a:string)
elseif a:string ==# '-' elseif a:string ==# '-'
@@ -221,10 +248,10 @@ function! pathogen#fnameescape(string) abort " {{{1
else else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif endif
endfunction " }}}1 endfunction
" Like findfile(), but hardcoded to use the runtimepath. " Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort "{{{1 function! pathogen#runtime_findfile(file,count) abort
let rtp = pathogen#join(1,pathogen#split(&rtp)) let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count) let file = findfile(a:file,rtp,a:count)
if file ==# '' if file ==# ''
@@ -232,101 +259,6 @@ function! pathogen#runtime_findfile(file,count) abort "{{{1
else else
return fnamemodify(file,':p') return fnamemodify(file,':p')
endif endif
endfunction " }}}1
" Section: Deprecated
function! s:warn(msg)
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction endfunction
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
return pathogen#surround(a:path . pathogen#slash() . '{}')
endfunction " }}}1
function! pathogen#incubate(...) abort " {{{1
let name = a:0 ? a:1 : 'bundle/{}'
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
return pathogen#interpose(name)
endfunction " }}}1
" Deprecated alias for pathogen#interpose().
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#infect('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
endif
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
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 file = pathogen#runtime_findfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
endif
if !s:vopen_warning
let s:vopen_warning = 1
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
else
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
endfunction " }}}1
function! s:Findcomplete(A,L,P) " {{{1
let sep = pathogen#slash()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction " }}}1
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
" vim:set et sw=2: " vim:set et sw=2: