Changed 'Q' to intelligently close window or kill buffer if it's the last one

This commit is contained in:
yan
2011-12-22 11:55:18 -08:00
parent 3eec4c39e6
commit 476e72ba63
3 changed files with 13 additions and 7 deletions

View File

@@ -0,0 +1,12 @@
" Use Q to intelligently close a window
" (if there are multiple windows into the same buffer)
" or kill the buffer entirely if it's the last window looking into that buffer
function! CloseWindowOrKillBuffer()
if(bufwinnr('%')) > 1
wincmd c
else
bdelete
endif
endfunction
nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR>