From 3ff705c08eba25bd94d33760445d41c811b5f853 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 9 Aug 2011 19:24:15 -0400 Subject: [PATCH] Provide :Vopen --- README.markdown | 3 +++ autoload/pathogen.vim | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 65e455e..b7b00cd 100644 --- a/README.markdown +++ b/README.markdown @@ -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 --- diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index c44e1fe..2f13292 100644 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -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(,'tabedit',) command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',) command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',) +command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,'lcd') " vim:set ft=vim ts=8 sw=2 sts=2: