Provide :Vopen

This commit is contained in:
Tim Pope
2011-08-09 19:24:15 -04:00
parent 85040e24e8
commit 3ff705c08e
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -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
---
+6 -1
View File
@@ -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: