Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Code to quit Vim when MBE is the last open buffer. Thanks to Moopet f…

…or the tip!
  • Loading branch information...
commit d78ab5f53918ce62e0ad9ca722d94fea18b48a84 1 parent 9161725
@fholgado fholgado authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 plugin/minibufexpl.vim
View
11 plugin/minibufexpl.vim
@@ -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("%"))
@@ -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 {{{
"=============================================================================
Please sign in to comment.
Something went wrong with that request. Please try again.