On Mon, Jul 17, 2006 at 10:59:41AM -0500, Tim Chase wrote:
> >Is there a way to delete all buffers matching a certain pattern?
> >For example, suppose I just read in all files in a directory and this is 
> >my buffer list:
> >1 "a.txt"
> >2 "b.txt"
> >3 "1.exe"
> >4 "2.exe"
> >5 "c.txt"
> >6 "3.exe"
> >7 "d.txt"
> >
> >I want to do something like ":bdelete *.exe".
> 
> The following seems to do the trick for me:
> 
>       :bufdo if bufname("%")=~'.exe$' | bdel | endif
> 
> or its case-insensitive cousin
> 
>       :bufdo if bufname("%")=~?'.exe$' | bdel | endif

     I think you want to escape the dot:

        :bufdo if bufname("%") =~? '\.exe$' | bdel | endif

(Optional spaces added because I find it more readable that way.)

HTH                                     --Benji Fisher

Reply via email to