commit f44845e4408aae03e018e98afb7fbf0c2ee87dd5 (tree)
parent 245ce889e2a6eb318cec865cf787e7bb0cb8aa95
Author: Jonathan Arnett <jonarnett90@gmail.com>
Date: Fri, 10 Feb 2017 12:35:36 -0500
Fix for empty buffer :Git command in Neovim (#785)
Detects whether the current buffer is empty; opens a new empty tab if so, a new tab of the same buffer if not.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -700,7 +700,11 @@ function! s:Git(bang, args) abort
let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=')
if exists(':terminal')
let dir = s:repo().tree()
- -tabedit %
+ if expand('%') != ''
+ -tabedit %
+ else
+ -tabnew
+ endif
execute 'lcd' fnameescape(dir)
execute 'terminal' git args
else