From 46652a304f0b89f36d70cee954d77e467ec0f6de Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 9 Mar 2022 10:50:24 -0500 Subject: [PATCH] Add :GUnlink, like in eunuch.vim This currently mirrors :GRemove, but gives us the option to add a third variant. --- autoload/fugitive.vim | 4 ++++ doc/fugitive.txt | 3 ++- plugin/fugitive.vim | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index dd09bec..60d4327 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -6629,6 +6629,10 @@ function! fugitive#RemoveCommand(line1, line2, range, bang, mods, arg, ...) abor return s:Remove('edit', a:bang) endfunction +function! fugitive#UnlinkCommand(line1, line2, range, bang, mods, arg, ...) abort + return s:Remove('edit', a:bang) +endfunction + function! fugitive#DeleteCommand(line1, line2, range, bang, mods, arg, ...) abort return s:Remove('bdelete', a:bang) endfunction diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 7e296c4..adccbc2 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -227,8 +227,9 @@ that are part of Git repositories). passed. Add a ! to pass -f and forcefully discard the buffer. - *:GRemove* + *:GRemove* *:GUnlink* :GRemove Like |:GDelete|, but keep the (now empty) buffer around. +:GUnlink *:GBrowse* :GBrowse Open the current file, blob, tree, commit, or tag diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 9f3ab4f..0a9fb72 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -600,6 +600,7 @@ exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwr exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( , , +"", 0, "", )' exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(, , +"", 0, "", )' +exe 'command! -bar -bang -nargs=0 GUnlink exe fugitive#UnlinkCommand(, , +"", 0, "", )' exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(, , +"", 0, "", )' exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( , , +"", 0, "", )' exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(, , +"", 0, "", )'