mirror of
https://github.com/tpope/vim-pathogen.git
synced 2026-06-01 11:18:51 +02:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
+37
-72
@@ -1,35 +1,29 @@
|
||||
pathogen.vim
|
||||
============
|
||||
# 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
|
||||
private directories.
|
||||
|
||||
Installation
|
||||
------------
|
||||
## Installation
|
||||
|
||||
Install to `~/.vim/autoload/pathogen.vim`. Or copy and paste:
|
||||
|
||||
mkdir -p ~/.vim/autoload ~/.vim/bundle
|
||||
curl https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim \
|
||||
> ~/.vim/autoload/pathogen.vim
|
||||
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
|
||||
curl -Sso ~/.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`
|
||||
to `~\vimfiles`.
|
||||
|
||||
Runtime Path Manipulation
|
||||
-------------------------
|
||||
## Runtime Path Manipulation
|
||||
|
||||
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
|
||||
in the following super-minimal example:
|
||||
|
||||
call pathogen#infect()
|
||||
execute pathogen#infect()
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
|
||||
@@ -38,22 +32,24 @@ under `~/.vim/bundle`, and they will be added to the `'runtimepath'`.
|
||||
Observe:
|
||||
|
||||
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
|
||||
whatever repository you keep your dot files in. I don't like to get
|
||||
crazy.
|
||||
|
||||
If you don't like the directory name `bundle`, you can pass a different
|
||||
name as an argument:
|
||||
If you don't like the directory name `bundle`, you can pass a runtime relative
|
||||
glob as an argument:
|
||||
|
||||
call pathogen#infect('stuff')
|
||||
execute pathogen#infect('stuff/{}')
|
||||
|
||||
You can also pass an entire path instead. I keep the plugins I maintain
|
||||
under `~/src`, and this is how I add them:
|
||||
The `{}` indicates where the expansion should occur. Currently only a
|
||||
trailing `{}` is supported.
|
||||
|
||||
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('~/src/vim/bundle/{}')
|
||||
|
||||
Normally to generate documentation, Vim expects you to run `:helptags`
|
||||
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.
|
||||
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.
|
||||
For example, when editing a PDF file like I do every day, I might notice
|
||||
something weird in the syntax highlighting and want to have a look:
|
||||
`:Vopen`, `:Vedit`, `:Vsplit`, `:Vvsplit`, `:Vtabedit`, `:Vpedit`, and
|
||||
`:Vread` have all moved to [scriptease.vim][]
|
||||
|
||||
:sp $VIMRUNTIME/syntax/pdf.vim
|
||||
[scriptease.vim]: https://github.com/tpope/vim-scriptease
|
||||
|
||||
Even the best case scenario with tab complete is painful:
|
||||
|
||||
: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
|
||||
---
|
||||
## FAQ
|
||||
|
||||
> 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
|
||||
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
|
||||
> `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
|
||||
:UseVimball ~/.vim/bundle/name
|
||||
|
||||
Contributing
|
||||
------------
|
||||
## Contributing
|
||||
|
||||
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 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`.
|
||||
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
|
||||
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
|
||||
edge case answer in my book.
|
||||
|
||||
Self-Promotion
|
||||
--------------
|
||||
## Self-Promotion
|
||||
|
||||
Like pathogen.vim? Follow the repository 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
|
||||
[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`.
|
||||
|
||||
+152
-59
@@ -1,12 +1,12 @@
|
||||
" pathogen.vim - path option manipulation
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.0
|
||||
" Version: 2.1
|
||||
|
||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||
"
|
||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
||||
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc
|
||||
" prior to `fileype plugin indent on` is the only other setup necessary.
|
||||
" ~\vimfiles\bundle), adding `call pathogen#infect()` to the top of your
|
||||
" .vimrc is the only other setup necessary.
|
||||
"
|
||||
" The API is documented inline below. For maximum ease of reading,
|
||||
" :set foldmethod=marker
|
||||
@@ -16,18 +16,34 @@ if exists("g:loaded_pathogen") || &cp
|
||||
endif
|
||||
let g:loaded_pathogen = 1
|
||||
|
||||
" Point of entry for basic default usage. Give a directory name to invoke
|
||||
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
|
||||
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
|
||||
" pathogen#cycle_filetype() is invoked.
|
||||
function! s:warn(msg)
|
||||
if &verbose
|
||||
echohl WarningMsg
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
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
|
||||
let source_path = a:0 ? a:1 : 'bundle'
|
||||
if source_path =~# '[\\/]'
|
||||
call pathogen#runtime_prepend_subdirectories(source_path)
|
||||
let path = a:0 ? a:1 : '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 pathogen#runtime_append_all_bundles(source_path)
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#surround(path . '/{}')
|
||||
endif
|
||||
call pathogen#cycle_filetype()
|
||||
return ''
|
||||
endfunction " }}}1
|
||||
|
||||
" Split a path into a list.
|
||||
@@ -74,8 +90,11 @@ function! pathogen#uniq(list) abort " {{{1
|
||||
let i = 0
|
||||
let seen = {}
|
||||
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)
|
||||
elseif a:list[i] ==# ''
|
||||
let i += 1
|
||||
let empty = 1
|
||||
else
|
||||
let seen[a:list[i]] = 1
|
||||
let i += 1
|
||||
@@ -108,8 +127,9 @@ function! pathogen#cycle_filetype() " {{{1
|
||||
endif
|
||||
endfunction " }}}1
|
||||
|
||||
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
|
||||
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if it ends
|
||||
" in a tilde or its basename or full name is included in the list
|
||||
" g:pathogen_disabled.
|
||||
function! pathogen#is_disabled(path) " {{{1
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
@@ -117,29 +137,48 @@ function! pathogen#is_disabled(path) " {{{1
|
||||
return 0
|
||||
endif
|
||||
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
|
||||
|
||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
||||
" directories in those subdirectories.
|
||||
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
||||
let sep = pathogen#separator()
|
||||
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])')
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. If the directory is already included, move it to the
|
||||
" outermost position. Wildcards are added as is. Ending a path in /{} causes
|
||||
" all subdirectories to be added (except those in g:pathogen_disabled).
|
||||
function! pathogen#surround(path) abort " {{{1
|
||||
let sep = pathogen#separator()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
let path = expand(a:path)
|
||||
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
||||
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
|
||||
if a:path =~# '[\\/]{}$'
|
||||
let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
|
||||
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
|
||||
endfunction " }}}1
|
||||
|
||||
" For each directory in rtp, check for a subdirectory named dir. If it
|
||||
" exists, add all subdirectories of that subdirectory to the rtp, immediately
|
||||
" after the original directory. If no argument is given, 'bundle' is used.
|
||||
" Repeated calls with the same arguments are ignored.
|
||||
function! pathogen#runtime_append_all_bundles(...) " {{{1
|
||||
" 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(source_path).') to pathogen#surround('.string(source_path.'/{}').')')
|
||||
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 name = a:0 ? a:1 : 'bundle'
|
||||
let name = a:0 ? a:1 : 'bundle/{}'
|
||||
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
||||
return ""
|
||||
endif
|
||||
@@ -147,47 +186,100 @@ function! pathogen#runtime_append_all_bundles(...) " {{{1
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
|
||||
if name =~# '{}$'
|
||||
let list += 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
|
||||
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
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction " }}}1
|
||||
|
||||
" Deprecated alias for pathogen#incubate().
|
||||
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(source_path).') to pathogen#incubate('.string(source_path.'/{}').')')
|
||||
return call('pathogen#incubate', map(copy(a:000, 'v:val . "/{}"'))
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = ''
|
||||
" }}}1
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() " {{{1
|
||||
function! pathogen#helptags() abort " {{{1
|
||||
let sep = pathogen#separator()
|
||||
for dir 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'))
|
||||
helptags `=dir.'/doc'`
|
||||
endif
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in split(glob(glob), "\n")
|
||||
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'))
|
||||
helptags `=dir.'/doc'`
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction " }}}1
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Like findfile(), but hardcoded to use the runtimepath.
|
||||
function! pathogen#rtpfindfile(file,count) "{{{1
|
||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
||||
return fnamemodify(findfile(a:file,rtp,a:count),':p')
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort " {{{1
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
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 file = pathogen#rtpfindfile(a:file,a:count)
|
||||
let file = pathogen#runtime_findfile(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)
|
||||
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
|
||||
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
|
||||
endfunction " }}}1
|
||||
|
||||
@@ -205,12 +297,13 @@ function! s:Findcomplete(A,L,P) " {{{1
|
||||
else
|
||||
let request = a:A
|
||||
endif
|
||||
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*'
|
||||
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,'v:val[strlen(path)+1:-1]')
|
||||
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
|
||||
for match in matches
|
||||
let found[match] = 1
|
||||
endfor
|
||||
@@ -218,13 +311,13 @@ function! s:Findcomplete(A,L,P) " {{{1
|
||||
return sort(keys(found))
|
||||
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 -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')
|
||||
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 ft=vim ts=8 sw=2 sts=2:
|
||||
" vim:set et sw=2:
|
||||
|
||||
Reference in New Issue
Block a user