From 4d3835f637044e618ee94a0b5c31852d32f22205 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 20 Aug 2018 19:12:17 -0400 Subject: [PATCH] Accept buffer number to FugitiveRoute() --- autoload/fugitive.vim | 5 ++++- plugin/fugitive.vim | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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