Vim :buffers what %a and # mean?

What do %a and # mean in VIM :buffers window?

Vim :buffers window


Solution 1:

That information is contained in ":help :buffers". I will quote it here:

Indicators (chars in the same column are mutually exclusive):
u   an unlisted buffer (only displayed when [!] is used)
       |unlisted-buffer|
 %  the buffer in the current window
 #  the alternate buffer for ":e #" and CTRL-^
  a an active buffer: it is loaded and visible
  h a hidden buffer: It is loaded, but currently not
       displayed in a window |hidden-buffer|
   -    a buffer with 'modifiable' off
   =    a readonly buffer
    +   a modified buffer
    x   a buffer with read errors

So to answer your specific question, "%" means the current buffer in the window your cursor is in when you did ":buffers". "a" means a buffer you can currently see. Finally, "#" is the alternate buffer, which usually means the last buffer you were editing.

Solution 2:

In addition, # and % are substituted for literal filenames when executing files. For example, when editing a Python file, if you type :!python %, it executes the current file as a Python file. Similarly, replacing % with # executes the alternate file. Very useful. :)