Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
close_hidden_buffers.vim
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
function! s:CloseHiddenBuffers()
let open_buffers = []
for i in range(tabpagenr('$'))
call extend(open_buffers, tabpagebuflist(i + 1))
endfor
for num in range(1, bufnr("$") + 1)
if buflisted(num) && index(open_buffers, num) == -1
exec "bdelete ".num
endif
endfor
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.