vimtricks.wiki Concise Vim tricks, one at a time.

How do I list all buffers including unlisted ones like help pages and quickfix?

Answer

:ls!

Explanation

Running :ls shows only your "listed" buffers — the files you've opened for editing. But Vim maintains many more buffers behind the scenes: help pages, the quickfix list, scratch buffers, and netrw directory listings. :ls! (with a bang) reveals all of them, including those normally hidden from the standard buffer list.

How it works

  • :ls (or :buffers) displays only listed buffers — those you've opened via :e, :split, or as arguments
  • :ls! adds unlisted buffers to the output, marked with a u flag in the first column
  • Common unlisted buffers you'll see: [Help] pages, [Quickfix List], [No Name] scratch buffers, and [Command Line] history

Example

After :help gf and a :grep search:

:ls!
  1  h   "help"              line 1
  2  #   "myfile.go"         line 42
  3 %a   "main.go"           line 1
  4 u    "[Quickfix List]"   line 1

The u flag on buffer 4 indicates it is unlisted — invisible to plain :ls but accessible via :b 4 or :buffer [Quickfix List].

Tips

  • Unlisted buffers can still be navigated to with :b {N} using the buffer number shown
  • Use :bdelete {N} to remove an unlisted buffer if it is cluttering the list
  • In the flags column: h = hidden, % = current, # = alternate, a = active, u = unlisted
  • This is especially useful when debugging unexpected buffer behavior or when a help page lingers in memory

Next

How do I complete identifiers using ctags from within insert mode?