From 0a24e781b256f4d9b1e6ed466b93cded4a095cc0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 25 Aug 2011 19:07:50 -0400 Subject: [PATCH] Allow exiting vim from q in sole buffer :Gstatus --- plugin/fugitive.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index ddf29bb..d8babb4 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1760,6 +1760,9 @@ function! s:ReplaceCmd(cmd,...) abort silent edit! silent exe 'keepalt file '.s:fnameescape(fn) call delete(tmp) + if bufname('$') == tmp + silent execute 'bwipeout '.bufnr('$') + endif silent exe 'doau BufReadPost '.s:fnameescape(fn) endfunction @@ -1812,7 +1815,7 @@ function! s:BufReadIndex() nnoremap dv :execute StageDiff('Gvdiff') nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap p :execute StagePatch(line("'<"),line("'>")) - nnoremap q :bdelete + nnoremap q :if bufnr('$') == 1quitelsebdeleteendif nnoremap R :edit catch /^fugitive:/ return 'echoerr v:errmsg'