mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 14:23:51 -05:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user