mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 12:53:52 -05:00
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:
committed by
Tim Pope
parent
245ce889e2
commit
f44845e440
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user