Can I close all buffers by regex, for instance all buffers that hold open .js files?Effectively what I want is:bd *.jsBut even with ! if more than one .js is open I get,E93: More than one match for *.js
Closing all buffers that represent .js files?
buffers
Your question is a duplicate of the following question on SO: https://stackoverflow.com/questions/3155461/how-to-delete-multiple-buffers-in-vimThe accepted answer being: use CTRL-A on the command line. This way :bd *.js will become :bd file1.js file2.js file42.js.My loop-free answer (in case more control is required) was:function! s:BDExt(ext)  let buffers = filter(range(1, bufnr('$')), 'buflisted(v:val) && bufname(v:val) =~ \.'.a:ext.'$')  if empty(buffers) |throw no *..a:ext. buffer | endif  exe 'bd '.join(buffers, ' ')endfunctioncommand! -nargs=1 BDExt :call s:BDExt(<f-args>)