vim - Vimscript: Number of listed buffers -


in vimscript, need count of buffers considered listed/listable (i.e. buffers not have unlisted, 'u', attribute).

what's recommended way of deriving value?

you use bufnr() number of last buffer, create list 1 number , filter removing unlisted buffers, using buflisted() function test expression.

" 'possible' buffers may exist let b_all = range(1, bufnr('$'))  " unlisted ones let b_unl = filter(b_all, 'buflisted(v:val)')  " number of unlisted ones let b_num = len(b_unl)  " or... @ once let b_num = len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -