diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index dcfa203..a9390e4 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -522,7 +522,10 @@ function! s:Relative(...) abort endfunction function! fugitive#Route(object, ...) abort - if a:object =~# '^[~$]' + if type(a:object) == type(0) + let name = bufname(a:object) + return s:PlatformSlash(name =~# '^$\|^/\|^\a\+:' ? name : getcwd() . '/' . name) + elseif a:object =~# '^[~$]' let prefix = matchstr(a:object, '^[~$]\i*') let owner = expand(prefix) return s:PlatformSlash((len(owner) ? owner : prefix) . strpart(a:object, len(prefix))) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 8b667dd..98011b6 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -44,7 +44,7 @@ function! FugitiveReal(...) abort endfunction function! FugitiveRoute(...) abort - return fugitive#Route(a:0 ? a:1 : ':/', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) + return fugitive#Route(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction function! FugitivePath(...) abort