>> I'm doing this with the following code: >> autocmd BufAdd * let g:zbuflistcount += 1 >> autocmd BufDelete * let g:zbuflistcount -= 1 >> >> The problem is I found this to be very unreliable in some circumstances, >> and I'm not sure why. > > One thing that I think could cause it, is problem/restriction of > nested autocommands. By default, nested autocommands are suppressed. > Thus if autocommand creates abufffer, then [nested] autotommands > will not be executed (unless plugin uses word 'nested' ).
Ahh yes. Thanks for the insight. I noticed that BufAdd would not be fired sometimes when plugins would create new buffers from autocmds (like minibufexpl plugin). I will read about this 'nested' keyword of which you speak. > > I just use bufnr('$') in my statusline. Simple and fast approximation. > > Yakov > --Matt