commit b7b23001def8d2ae816ff6dd772cd50976189e0e (tree)
parent b319b694539017dcd789dc2c42f784a30d7b28b8
Author: David Elentok <3david@gmail.com>
Date: Thu, 10 Sep 2015 22:20:18 +0300
Allow using the "%" variable in git commands
Closes https://github.com/tpope/vim-fugitive/issues/686
For example, when running:
:Git add %
neovim throws the following exception:
E499: Empty file name for '%' or '#',
only works with ":p:h": terminal git add %
It is a result of the tabnew command, it creates a new blank tab where
"%" is empty.
This commit changes "tabnew" to "tabedit %" so you're still working on
the same file.
Once the command is done running the tab closes.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -683,7 +683,7 @@ function! s:Git(bang, args) abort
let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=')
if exists(':terminal')
let dir = s:repo().tree()
- tabnew
+ tabedit %
execute 'lcd' fnameescape(dir)
execute 'terminal' git args
else