Provide :Gdelete

Closes https://github.com/tpope/vim-fugitive/issues/804
This commit is contained in:
Tim Pope
2017-06-08 01:20:21 -04:00
parent 280bbdb6eb
commit be2ff98db5
3 changed files with 10 additions and 6 deletions

View File

@@ -1924,7 +1924,7 @@ function! s:MoveComplete(A,L,P) abort
endif
endfunction
function! s:Remove(force) abort
function! s:Remove(after, force) abort
if s:buffer().commit() ==# ''
let cmd = ['rm']
elseif s:buffer().commit() ==# '0'
@@ -1942,7 +1942,7 @@ function! s:Remove(force) abort
return 'echoerr '.string(v:errmsg)
else
call fugitive#reload_status()
return 'edit'.(a:force ? '!' : '')
return a:after . (a:force ? '!' : '')
endif
endfunction
@@ -1950,7 +1950,8 @@ augroup fugitive_remove
autocmd!
autocmd User Fugitive if s:buffer().commit() =~# '^0\=$' |
\ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,s:MoveComplete Gmove :execute s:Move(<bang>0,<q-args>)" |
\ exe "command! -buffer -bar -bang Gremove :execute s:Remove(<bang>0)" |
\ exe "command! -buffer -bar -bang Gremove :execute s:Remove('edit',<bang>0)" |
\ exe "command! -buffer -bar -bang Gdelete :execute s:Remove('bdelete',<bang>0)" |
\ endif
augroup END