Skip to content

added bang option #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions plugin/delete-hidden-buffers.vim
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
if !exists("*DeleteHiddenBuffers") " Clear all hidden buffers when running
function DeleteHiddenBuffers() " Vim with the 'hidden' option
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
endif
command! DeleteHiddenBuffers call DeleteHiddenBuffers()
function! DeleteHiddenBuffers(bang) " Vim with the 'hidden' option
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'.a:bang buf
endfor
endfunction
command! -bang DeleteHiddenBuffers call DeleteHiddenBuffers(<q-bang>)