Home Explore Blog CI



neovim

5th chunk of `runtime/doc/usr_22.txt`
041edc7404808c68dfc15452e923a9897928c8a7261f066200000001000007d7
 contents, but also all the marks, settings, and
other stuff that goes with it.


HIDDEN BUFFERS

Suppose you are editing the file one.txt and need to edit the file two.txt.
You could simply use ":edit two.txt", but since you made changes to one.txt
that won't work.  You also don't want to write one.txt yet.  Vim has a
solution for you: >

	:hide edit two.txt

The buffer "one.txt" disappears from the screen, but Vim still knows that you
are editing this buffer, so it keeps the modified text.  This is called a
hidden buffer: The buffer contains text, but you can't see it.
   The argument of ":hide" is another command.  ":hide" makes that command
behave as if the 'hidden' option was set.  You could also set this option
yourself.  The effect is that when any buffer is abandoned, it becomes hidden.
   Be careful!  When you have hidden buffers with changes, don't exit Vim
without making sure you have saved all the buffers.


INACTIVE BUFFERS

   When a buffer has been used once, Vim remembers some information about it.
When it is not displayed in a window and it is not hidden, it is still in the
buffer list.  This is called an inactive buffer.  Overview:

   Active		Appears in a window, text loaded.
   Hidden		Not in a window, text loaded.
   Inactive		Not in a window, no text loaded.

The inactive buffers are remembered, because Vim keeps information about them,
like marks.  And remembering the file name is useful too, so that you can see
which files you have edited.  And edit them again.


LISTING BUFFERS

View the buffer list with this command: >

	:buffers

A command which does the same, is not so obvious to list buffers, but is much
shorter to type: >

	:ls

The output could look like this:

  1 #h   "help.txt"			line 62 ~
  2 %a + "usr_21.txt"			line 1 ~
  3      "usr_toc.txt"			line 1 ~

The first column contains the buffer number.  You can use this to edit the
buffer without having to type the name, see below.
   After the buffer number come the flags.  Then the name of

Title: Hidden and Inactive Buffers in Vim
Summary
This section explains the concept of hidden and inactive buffers in Vim. Hidden buffers are those that are not currently displayed but still contain loaded text, while inactive buffers are those that Vim remembers information about but does not load text from. The `:buffers` or `:ls` command lists all buffers, including their status and number, which can be used to quickly edit them.