vimrc: add Bwmatch function

This commit is contained in:
Josh Holtrop 2011-12-15 14:39:25 -05:00
parent c0e3452832
commit fe29d11351

25
vimrc
View File

@ -121,3 +121,28 @@ if has("autocmd")
autocmd QuickFixCmdPre vimgrep copen
autocmd FileType html set sw=2 ts=2 sts=2
endif " has("autocmd")
if !exists('s:loaded')
s:loaded = 0
endif
if s:loaded
delfunction Bwmatch
delcommand Bwmatch
endif
function Bwmatch(exp)
let last = bufnr('$')
let index = 0
while index <= last
if bufexists(index) && bufname(index) =~ a:exp
execute ':bw ' . index
endif
let index += 1
endwhile
redraw!
endfunction
command -nargs=1 Bwmatch :call Bwmatch('<args>')
let s:loaded = 1