Improve window killer (Q) - close window if multiple windows to same buffer exist

This commit is contained in:
yan 2012-01-25 12:09:40 -08:00
parent fc2d9b6d64
commit 5716eaa239

View File

@ -2,7 +2,9 @@
" (if there are multiple windows into the same buffer) " (if there are multiple windows into the same buffer)
" or kill the buffer entirely if it's the last window looking into that buffer " or kill the buffer entirely if it's the last window looking into that buffer
function! CloseWindowOrKillBuffer() function! CloseWindowOrKillBuffer()
if(bufwinnr('%')) > 1 let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')"))
if number_of_windows_to_this_buffer > 1
wincmd c wincmd c
else else
bdelete bdelete