On Mon, Nov 13, 2006 at 08:25:42AM -0800, Eggum, DavidX S wrote:
> Try this (lightly tested):
> 
> autocmd BufDelete * let s:prev_count -= 1
> set rulerformat=%60(%=%{GetBufCount()}%)
> 
> let s:prev_last = 0
> let s:prev_count = 0
> function! GetBufCount()
>    let last = bufnr('$')
>    if last != s:prev_last
>       " A buffer has been added, update the count
>       let lst = range(s:prev_last+1, last)
>       call filter(lst, 'buflisted(v:val)')
>       let s:prev_count += len(lst)
>       let s:prev_last = last
>    endif
>    return s:prev_count
> endfunction

Yeah only problem is it won't pick up ":set nobuflisted". However, the
filter call might be a big speed boost; so I'll benchmark it.

> 
> David

--Matt

Reply via email to