Skip to content

Instantly share code, notes, and snippets.

@dsummersl
Created November 24, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsummersl/2b9faa9133322c33b465 to your computer and use it in GitHub Desktop.
Save dsummersl/2b9faa9133322c33b465 to your computer and use it in GitHub Desktop.
:bda command to clear out hidden buffers
" delete all buffers function
function! DeleteHiddenBuffers()
let tpbl=[]
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
silent execute 'bwipeout' buf
endfor
endfunction
cabbrev bda call DeleteHiddenBuffers()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment