I am creating a plugin in vim that involves having a sidebar, within which you can switch between several different buffers with different functions. I am wondering how to hide these buffers from the buffer list (when you type :buffers or :ls) so as not to clutter the buffer list.
You might try making the buffer unlisted with
:set nobl (see
:h 'buflisted'). This is a buffer local setting so it only affects the current buffer.
Unlisted buffers don't show up with
:ls by default (see below).
Not sure if this will work with what you have in mind for your plugin as you didn't provide a lot of details. But the basic requirement would be fulfilled.
You can list such buffers by adding
:ls or by adding
:ls u. The latter shows only unlisted buffers. You can edit an unlisted buffer by switching to it using
:b # where
# is its buffer number. From there you can revert to listed status with