Skip to content

Commit

Permalink
Code to quit Vim when MBE is the last open buffer. Thanks to Moopet f…
Browse files Browse the repository at this point in the history
…or the tip!
  • Loading branch information
fholgado committed May 20, 2011
1 parent 9161725 commit d78ab5f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugin/minibufexpl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ augroup MiniBufExplorer
autocmd MiniBufExplorer BufDelete * call <SID>DEBUG('-=> BufDelete AutoCmd', 10) |call <SID>AutoUpdate(expand('<abuf>'),bufnr("%"))
autocmd MiniBufExplorer BufDelete * call <SID>DEBUG('-=> BufDelete ModTrackingListClean AutoCmd for buffer '.bufnr("%"), 10) |call <SID>CleanModTrackingList(bufnr("%"))
autocmd MiniBufExplorer BufEnter * call <SID>DEBUG('-=> BufEnter AutoCmd', 10) |call <SID>AutoUpdate(-1,bufnr("%"))
autocmd MiniBufExplorer BufEnter * call <SID>DEBUG('-=> BufEnter Checking for Last window', 10) |call <SID>CheckForLastWindow()
autocmd MiniBufExplorer BufWritePost * call <SID>DEBUG('-=> BufWritePost AutoCmd', 10) |call <SID>AutoUpdate(-1,bufnr("%"))
autocmd MiniBufExplorer CursorHold * call <SID>DEBUG('-=> CursroHold AutoCmd', 10) |call <SID>AutoUpdateCheck(bufnr("%"))
autocmd MiniBufExplorer CursorHoldI * call <SID>DEBUG('-=> CursorHoldI AutoCmd', 10) |call <SID>AutoUpdateCheck(bufnr("%"))
Expand Down Expand Up @@ -2028,6 +2029,16 @@ function! <SID>DEBUG(msg, level)
endif

endfunc " }}}
" CheckForLastWindow - Quit Vim if :q is excecuted when no files are open {{{
function! <SID>CheckForLastWindow()
" if the window is quickfix go on
if &buftype=="quickfix"
" if this window is last on screen quit without warning
if winbufnr(2) == -1
quit
endif
endif
endfunction " }}}

" MBE Script History {{{
"=============================================================================
Expand Down

0 comments on commit d78ab5f

Please sign in to comment.