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.
This commit is contained in:
Jonathan Arnett
2017-02-10 12:35:36 -05:00
committed by Tim Pope
parent 245ce889e2
commit f44845e440

View File

@@ -700,7 +700,11 @@ function! s:Git(bang, args) abort
let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=') let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=')
if exists(':terminal') if exists(':terminal')
let dir = s:repo().tree() let dir = s:repo().tree()
if expand('%') != ''
-tabedit % -tabedit %
else
-tabnew
endif
execute 'lcd' fnameescape(dir) execute 'lcd' fnameescape(dir)
execute 'terminal' git args execute 'terminal' git args
else else