Is there a way to distinguish between hidden and active buffers in Vim?
I need to determine if a buffer is active in a window so I can toggle it.
Tried bufloaded
, bufexists
and buflisted
but they all return 1 for both active and hidden buffers.
(I have set hidden
and set bufhidden=hide
in my vimrc)
Use bufwinnr()
to check if a buffer is open in a window. The result is -1
if it is not.
You can use :ls to see a list of all buffers. Buffers with a 'h' next to the buffer number are hidden. 'a' indicates active buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With