mirror of
https://github.com/tpope/vim-pathogen.git
synced 2026-06-01 11:18:51 +02:00
Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac4dd9494f | |||
| e0a3efbda5 | |||
| c6bc424045 | |||
| a553410f1b | |||
| e9fb0914db | |||
| 24f5cdd805 | |||
| 06da921608 | |||
| f4fd6044e3 | |||
| e7857bed4e | |||
| ddfb1f14d7 | |||
| 17f6f4d585 | |||
| 3ec671e112 | |||
| c636c19f6a | |||
| 39964dd295 | |||
| 6655e33627 | |||
| 379b8f7082 | |||
| 0f4710063e | |||
| 020ab25c38 | |||
| 7ba2e1b67a | |||
| 8c91196cfd | |||
| b4f20ff0ac | |||
| 84a3dd0d81 | |||
| 4d584ea8c8 | |||
| 8b27115203 | |||
| 890e013d96 | |||
| 68ead6af17 | |||
| e2f96ded89 | |||
| a6004fd531 | |||
| b4174e4d1a | |||
| b9fb0dfd81 | |||
| 91e6378908 | |||
| ed01fca95c | |||
| 1b644bf4b2 | |||
| 336611a3d0 | |||
| bff90d72a1 | |||
| 099b918141 | |||
| 5b5bee9c44 | |||
| 9a40364c60 | |||
| e1687eb4d9 | |||
| f66e6f483f | |||
| bd0c1abcce | |||
| 50531a4102 | |||
| 2d3784070d | |||
| 60c6fd24cf | |||
| af23f56f42 | |||
| a341581743 | |||
| 0230129c50 | |||
| 5cb9a24de8 | |||
| d7be5c7712 | |||
| 0f43888aba | |||
| 8c54b5ec0d | |||
| 3bc4b397b2 | |||
| 543041b3ca | |||
| f45c82a760 | |||
| c9ca3770db | |||
| 698239024b | |||
| 16a1a84072 | |||
| 1270dceb1f | |||
| f1926ab673 | |||
| 0c3769d94e | |||
| 2c14c6095e | |||
| 3111f06b70 | |||
| a517eed987 | |||
| 74ae96483b | |||
| 12c3483515 | |||
| f195ac5e40 | |||
| 1050a784cc | |||
| 6cfc5e7759 | |||
| 1b7f130f57 | |||
| 98659f0af7 | |||
| a860d000e1 | |||
| 92ca2e574b | |||
| 95c285e426 | |||
| a04bd7a195 | |||
| a1b2b09e6a | |||
| a2f7e9b93f | |||
| 6c741e636a | |||
| 0533e25018 | |||
| 268c6a06c4 | |||
| 40dcd3743b | |||
| 34eff0f3e4 | |||
| 5c657cbe99 | |||
| 619f9ed386 | |||
| f79f1bb82b | |||
| 54f9afb244 | |||
| bb6c0b8f5b | |||
| 5eafb23d9b | |||
| d10ce854fc | |||
| 34b4567be4 | |||
| f467f117c1 | |||
| 07e7b35aef | |||
| 6aa1bbf839 | |||
| df8f1b0b30 | |||
| 1fde396c57 | |||
| 5bcf824e21 | |||
| c0dbda5258 | |||
| da1c3c08ed | |||
| 532f0ca7d9 | |||
| 47523d9bc0 | |||
| 1b46b4f991 | |||
| e5f413f480 | |||
| 49e6d62fb1 | |||
| 96b5726ef3 | |||
| 11e39a169a | |||
| 5e3fdd3a8a | |||
| 2f9fd6de08 | |||
| 09f2c3b7d3 | |||
| c9fb89dd6e | |||
| ab64b4ddd0 | |||
| 00ce0614f0 | |||
| 4462567926 | |||
| 4676508001 | |||
| 7701d82201 | |||
| a32131ce19 | |||
| af1361a446 | |||
| 9631019a3e | |||
| fbd0cc7040 | |||
| cb9717bba1 | |||
| 82cc6d795e | |||
| 7804dbd8d5 | |||
| 97c27be992 | |||
| dc26353727 | |||
| b8e184638f | |||
| fb16afe738 | |||
| 1e0c2b4393 |
@@ -0,0 +1,2 @@
|
|||||||
|
github: tpope
|
||||||
|
custom: ["https://www.paypal.me/vimpope"]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Follow the commit message guidelines at [commit.style](https://commit.style).
|
||||||
|
This is an absolute requirement for my repositories, and doing so proves you
|
||||||
|
actually read the contribution guidelines, which makes for a good first
|
||||||
|
impression.
|
||||||
|
|
||||||
|
Good commit messages imply good commits. Pull requests should typically be a
|
||||||
|
single commit, or for the rare complicated case, a series of atomic commits.
|
||||||
|
If I request a change, use `git commit --amend` or `git rebase --interactive`
|
||||||
|
and force push to your branch.
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -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.
|
||||||
+54
-71
@@ -1,35 +1,32 @@
|
|||||||
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
|
**For new users, I recommend using Vim's built-in package management
|
||||||
------------
|
instead.** `:help packages`
|
||||||
|
|
||||||
Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste:
|
## Installation
|
||||||
|
|
||||||
mkdir -p ~/.vim/autoload ~/.vim/bundle
|
Install to `~/.vim/autoload/pathogen.vim`.
|
||||||
curl https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim \
|
Or copy and paste the following into your terminal/shell:
|
||||||
> ~/.vim/autoload/pathogen.vim
|
|
||||||
|
|
||||||
If you don't have `curl`, use `wget -O -` instead.
|
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
|
||||||
|
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
||||||
|
|
||||||
By the way, if you're using Windows, change all occurrences of `~/.vim`
|
If you're using Windows, change all occurrences of `~/.vim` to `~\vimfiles`.
|
||||||
to `~\vimfiles`.
|
|
||||||
|
|
||||||
Runtime Path Manipulation
|
## 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
|
||||||
|
|
||||||
@@ -37,23 +34,24 @@ 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-fugitive.git
|
git clone https://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.
|
||||||
under `~/src`, and this is how I add them:
|
|
||||||
|
|
||||||
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 +65,33 @@ 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
|
## Native Vim Package Management
|
||||||
--------------------
|
|
||||||
|
|
||||||
As a guy who writes a lot of Vim script, I edit a lot of runtime files.
|
Vim 8 includes support for package management in a manner similar to
|
||||||
For example, when editing a PDF file like I do every day, I might notice
|
pathogen.vim. If you'd like to transition to this native support,
|
||||||
something weird in the syntax highlighting and want to have a look:
|
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.
|
||||||
|
|
||||||
:sp $VIMRUNTIME/syntax/pdf.vim
|
## Runtime File Editing
|
||||||
|
|
||||||
Even the best case scenario with tab complete is painful:
|
`:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and
|
||||||
|
`:Vread` have all moved to [scriptease.vim][].
|
||||||
|
|
||||||
:sp $VIMR<Tab>/synt<Tab>/pd<Tab>
|
[scriptease.vim]: https://github.com/tpope/vim-scriptease
|
||||||
|
|
||||||
The picture is even bleaker if the file in question sits in a
|
## FAQ
|
||||||
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 +113,23 @@ If you really must use one:
|
|||||||
:!mkdir ~/.vim/bundle/name
|
:!mkdir ~/.vim/bundle/name
|
||||||
:UseVimball ~/.vim/bundle/name
|
:UseVimball ~/.vim/bundle/name
|
||||||
|
|
||||||
Contributing
|
> Why don't my plugins load when I use Vim sessions?
|
||||||
------------
|
|
||||||
|
Vim sessions default to capturing all global options, which includes the
|
||||||
|
`'runtimepath'` that pathogen.vim manipulates. This can cause other problems
|
||||||
|
too, so I recommend turning that behavior off:
|
||||||
|
|
||||||
|
set sessionoptions-=options
|
||||||
|
|
||||||
|
## 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 +138,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 +147,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`.
|
||||||
|
|||||||
+180
-146
@@ -1,44 +1,63 @@
|
|||||||
" 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.4
|
||||||
|
|
||||||
" 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 `execute 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.
|
||||||
" :set foldmethod=marker
|
|
||||||
|
|
||||||
if exists("g:loaded_pathogen") || &cp
|
if exists("g:loaded_pathogen") || &cp
|
||||||
finish
|
finish
|
||||||
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
|
" Point of entry for basic default usage. Give a relative path to invoke
|
||||||
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
|
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
|
||||||
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
|
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
|
||||||
" pathogen#cycle_filetype() is invoked.
|
" subdirectories inside "bundle" inside all directories in the runtime path.
|
||||||
function! pathogen#infect(...) abort " {{{1
|
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
|
||||||
let source_path = a:0 ? a:1 : 'bundle'
|
" on versions of Vim without native package support.
|
||||||
if source_path =~# '[\\/]'
|
function! pathogen#infect(...) abort
|
||||||
call pathogen#runtime_prepend_subdirectories(source_path)
|
if a:0
|
||||||
|
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
|
||||||
else
|
else
|
||||||
call pathogen#runtime_append_all_bundles(source_path)
|
let paths = ['bundle/{}', 'pack/{}/start/{}']
|
||||||
endif
|
endif
|
||||||
|
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)
|
||||||
|
else
|
||||||
|
call pathogen#interpose(path)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
call pathogen#cycle_filetype()
|
call pathogen#cycle_filetype()
|
||||||
endfunction " }}}1
|
if pathogen#is_disabled($MYVIMRC)
|
||||||
|
return 'finish'
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
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 = ' '
|
||||||
@@ -62,169 +81,184 @@ 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
|
||||||
|
|
||||||
" Remove duplicates from a list.
|
|
||||||
function! pathogen#uniq(list) abort " {{{1
|
|
||||||
let i = 0
|
|
||||||
let seen = {}
|
|
||||||
while i < len(a:list)
|
|
||||||
if has_key(seen,a:list[i])
|
|
||||||
call remove(a:list,i)
|
|
||||||
else
|
|
||||||
let seen[a:list[i]] = 1
|
|
||||||
let i += 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return a:list
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" \ on Windows unless shellslash is set, / everywhere else.
|
|
||||||
function! pathogen#separator() abort " {{{1
|
|
||||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convenience wrapper around glob() which returns a list.
|
|
||||||
function! pathogen#glob(pattern) abort " {{{1
|
|
||||||
let files = split(glob(a:pattern),"\n")
|
|
||||||
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Like pathogen#glob(), only limit the results to directories.
|
|
||||||
function! pathogen#glob_directories(pattern) abort " {{{1
|
|
||||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" 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
|
||||||
|
|
||||||
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
|
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||||
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
|
" basename or full name is included in the list g:pathogen_blacklist or the
|
||||||
function! pathogen#is_disabled(path) " {{{1
|
" comma delimited environment variable $VIMBLACKLIST.
|
||||||
|
function! pathogen#is_disabled(path) abort
|
||||||
if a:path =~# '\~$'
|
if a:path =~# '\~$'
|
||||||
return 1
|
return 1
|
||||||
elseif !exists("g:pathogen_disabled")
|
|
||||||
return 0
|
|
||||||
endif
|
endif
|
||||||
let sep = pathogen#separator()
|
let sep = pathogen#slash()
|
||||||
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
|
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
|
||||||
endfunction "}}}1
|
if !empty(blacklist)
|
||||||
|
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
||||||
|
endif
|
||||||
|
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
" 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. Curly braces are expanded with pathogen#expand().
|
||||||
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
function! pathogen#surround(path) abort
|
||||||
let sep = pathogen#separator()
|
let sep = pathogen#slash()
|
||||||
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)')
|
|
||||||
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
|
|
||||||
let rtp = pathogen#split(&rtp)
|
let rtp = pathogen#split(&rtp)
|
||||||
let path = expand(a:path)
|
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
|
||||||
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||||
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
|
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0 : -7])')
|
||||||
|
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||||
|
let &rtp = pathogen#join(before, rtp, after)
|
||||||
return &rtp
|
return &rtp
|
||||||
endfunction " }}}1
|
endfunction
|
||||||
|
|
||||||
" For each directory in rtp, check for a subdirectory named dir. If it
|
" For each directory in the runtime path, add a second entry with the given
|
||||||
" exists, add all subdirectories of that subdirectory to the rtp, immediately
|
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||||
" after the original directory. If no argument is given, 'bundle' is used.
|
function! pathogen#interpose(name) abort
|
||||||
" Repeated calls with the same arguments are ignored.
|
let sep = pathogen#slash()
|
||||||
function! pathogen#runtime_append_all_bundles(...) " {{{1
|
let name = a:name
|
||||||
let sep = pathogen#separator()
|
if has_key(s:done_bundles, name)
|
||||||
let name = a:0 ? a:1 : 'bundle'
|
|
||||||
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
|
||||||
return ""
|
return ""
|
||||||
endif
|
endif
|
||||||
let s:done_bundles .= name . "\n"
|
let s:done_bundles[name] = 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]
|
let list += reverse(filter(pathogen#expand(dir[0 : -6].name, sep.'after'), '!pathogen#is_disabled(v:val[0 : -7])')) + [dir]
|
||||||
else
|
else
|
||||||
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
|
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
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() " {{{1
|
function! pathogen#helptags() abort
|
||||||
let sep = pathogen#separator()
|
let sep = pathogen#slash()
|
||||||
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 map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||||
helptags `=dir.'/doc'`
|
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||||
endif
|
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfunction " }}}1
|
endfunction
|
||||||
|
|
||||||
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
|
||||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
for command in a:000
|
||||||
return fnamemodify(findfile(a:file,rtp,a:count),':p')
|
execute command
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
function! s:find(count,cmd,file,...) " {{{1
|
|
||||||
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
|
||||||
let file = pathogen#rtpfindfile(a:file,a:count)
|
|
||||||
if file ==# ''
|
|
||||||
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
|
||||||
elseif a:0
|
|
||||||
let path = file[0:-strlen(a:file)-2]
|
|
||||||
execute a:1.' `=path`'
|
|
||||||
return a:cmd.' '.fnameescape(a:file)
|
|
||||||
else
|
|
||||||
return a:cmd.' '.fnameescape(file)
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
function! s:Findcomplete(A,L,P) " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
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 matches = split(glob(path.sep.pattern),"\n")
|
|
||||||
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
|
||||||
call map(matches,'v:val[strlen(path)+1:-1]')
|
|
||||||
for match in matches
|
|
||||||
let found[match] = 1
|
|
||||||
endfor
|
|
||||||
endfor
|
endfor
|
||||||
return sort(keys(found))
|
return ''
|
||||||
endfunction " }}}1
|
endfunction
|
||||||
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>)
|
" Section: Unofficial
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,'lcd')
|
|
||||||
|
|
||||||
" vim:set ft=vim ts=8 sw=2 sts=2:
|
function! pathogen#is_absolute(path) abort
|
||||||
|
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" 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()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Convenience wrapper around glob() which returns a list.
|
||||||
|
function! pathogen#glob(pattern) abort
|
||||||
|
let files = split(glob(a:pattern),"\n")
|
||||||
|
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Like pathogen#glob(), only limit the results to directories.
|
||||||
|
function! pathogen#glob_directories(pattern) abort
|
||||||
|
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Remove duplicates from a list.
|
||||||
|
function! pathogen#uniq(list) abort
|
||||||
|
let i = 0
|
||||||
|
let seen = {}
|
||||||
|
while i < len(a:list)
|
||||||
|
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
||||||
|
call remove(a:list,i)
|
||||||
|
elseif a:list[i] ==# ''
|
||||||
|
let i += 1
|
||||||
|
let empty = 1
|
||||||
|
else
|
||||||
|
let seen[a:list[i]] = 1
|
||||||
|
let i += 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return a:list
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Backport of fnameescape().
|
||||||
|
function! pathogen#fnameescape(string) abort
|
||||||
|
if exists('*fnameescape')
|
||||||
|
return fnameescape(a:string)
|
||||||
|
elseif a:string ==# '-'
|
||||||
|
return '\-'
|
||||||
|
else
|
||||||
|
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Like findfile(), but hardcoded to use the runtimepath.
|
||||||
|
function! pathogen#runtime_findfile(file,count) abort
|
||||||
|
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
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
||||||
|
|||||||
Reference in New Issue
Block a user