mirror of
https://github.com/tpope/vim-pathogen.git
synced 2026-05-28 00:21:02 +02:00
Provide :Vopen
This commit is contained in:
@@ -103,6 +103,9 @@ Here's the full list of commands:
|
||||
* `:Vpedit`
|
||||
* `:Vread`
|
||||
|
||||
There's also `:Vopen`, which is like `:Vedit` but does an `:lcd` to the
|
||||
containing runtime directory first.
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
|
||||
@@ -176,11 +176,15 @@ function! pathogen#rtpfindfile(file,count) "{{{1
|
||||
return fnamemodify(findfile(a:file,rtp,a:count),':p')
|
||||
endfunction " }}}1
|
||||
|
||||
function! s:find(count,cmd,file) " {{{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
|
||||
@@ -220,5 +224,6 @@ command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvspli
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user