Allow exiting vim from q in sole buffer :Gstatus

This commit is contained in:
Tim Pope 2011-08-25 19:07:50 -04:00
parent 821f11176f
commit 0a24e781b2

View File

@ -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 <buffer> <silent> dv :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
nnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR>
nnoremap <buffer> <silent> R :<C-U>edit<CR>
catch /^fugitive:/
return 'echoerr v:errmsg'