Update vim-pathogen

This commit is contained in:
Anthony Rose 2020-10-28 13:49:26 +00:00
parent 2b4197a006
commit b6b1b9b03a
5 changed files with 146 additions and 134 deletions

View file

@ -0,0 +1,2 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]

View file

@ -1,14 +1,18 @@
If your [commit message sucks](http://stopwritingramblingcommitmessages.com/),
I'm not going to accept your pull request. I've explained very politely
dozens of times that
[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
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`.
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.
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
and a perverse knowledge of Vim script so vast that many would consider
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
edge case answer in my book.
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.

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.

View file

@ -4,9 +4,13 @@ Manage your `'runtimepath'` with ease. In practical terms, pathogen.vim
makes it super easy to install plugins and runtime files in their own
private directories.
**For new users, I recommend using Vim's built-in package management
instead.** `:help packages`
## 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 && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
@ -31,7 +35,7 @@ under `~/.vim/bundle`, and they will be added to the `'runtimepath'`.
Observe:
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.
If you really want to get crazy, you could set it up as a submodule in
@ -61,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.
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
`:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and

View file

@ -16,22 +16,29 @@ endif
let g:loaded_pathogen = 1
" 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#surround(). Curly braces are expanded with pathogen#expand():
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
" in the runtime path.
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
" subdirectories inside "bundle" inside all directories in the runtime path.
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
" on versions of Vim without native package support.
function! pathogen#infect(...) abort
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
if a:0
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
else
let paths = ['bundle/{}', 'pack/{}/start/{}']
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)
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
elseif path =~# '[{}*]'
call pathogen#interpose(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#interpose(path . '/{}')
call pathogen#interpose(path)
endif
endfor
call pathogen#cycle_filetype()
@ -97,10 +104,10 @@ function! pathogen#is_disabled(path) abort
return 1
endif
let sep = pathogen#slash()
let blacklist = map(
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
\ pathogen#split($VIMBLACKLIST),
\ 'substitute(v:val, "[\\/]$", "", "")')
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
endfunction
@ -109,7 +116,7 @@ endfunction
function! pathogen#surround(path) abort
let sep = pathogen#slash()
let rtp = pathogen#split(&rtp)
let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
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')
@ -174,19 +181,20 @@ endfunction
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern, ...) abort
let after = a:0 ? a:1 : ''
if a:pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 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 a:pattern =~# '{}'
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = a:pattern[strlen(pat) : -1]
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 = [a:pattern]
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 : ""')
@ -253,99 +261,4 @@ function! pathogen#runtime_findfile(file,count) abort
endif
endfunction
" Section: Deprecated
function! s:warn(msg) abort
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) abort
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
function! pathogen#incubate(...) abort
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
" Deprecated alias for pathogen#interpose().
function! pathogen#runtime_append_all_bundles(...) abort
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
if exists(':Vedit')
finish
endif
let s:vopen_warning = 0
function! s:find(count,cmd,file,lcd)
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
function! s:Findcomplete(A,L,P)
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
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 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':