Really I just have a confusion between a few terms, some of which may be synonymous:

  • buffers
  • tabs
  • files
  • windows

I want to understand these terms fully and any pointers in that direction would be appreciated. However, my immediate question is:

I like the method of switching between files that I get when multiple files are listed as arguments for the vim command. However, sometimes I am in an editing session and I realize that I want to edit another file as well, using the same macros, registers, etc., and without ending the editing session. How can I open another file from within vim such that :n and :prev will allow me to switch to and from the new file?

  • 3
    If you're interested in Vim, do visit Vi and Vim, a Stack Exchange for Vim.
    – muru
    Sep 27, 2015 at 16:53

2 Answers 2


Vim has a built-in help. You can read the section about the argument list with the command :help argument-list and get a list of all the commands.

  • :argadd filename to add a file to the argument list.
  • :argedit filename to add a file and start editing it.

For buffers and windows, you can read all about them in :h buffers :

- A buffer is the in-memory text of a file.
- A window is a viewport on a buffer.
- A tab page is a collection of windows.

And everything about tabs is in :h tabpage.

You can use them to edit multiple files in a session :

  • :tabe filename to start editing a file in a new tab.
  • :vne filename to start editing a file in a new vertically split window.
  • And many more commands ...

Assuming you meant :prev (:p is short for :print, not :previous), you can add a file to the list by editing it:

:e filename

Or, if you don't want to switch to the new file immediately, you can add it to the list of arguments:

:argadd filename

The list of buffers is separate, while editing a new file does create a buffer, you can create a buffer without adding to the argument list:

:badd filename

To traverse the buffers, you can do :bn and :bp.

  • With the experience I now have with Vim, this is actually the better answer—using buffers and :bn and :bp are better suited for what I was trying to accomplish, and you also answered the exact question I asked (:e, :argadd).
    – Wildcard
    Sep 9, 2016 at 2:12
  • @Wildcard the arglist is a subset of the buffer list. whilst it technically represents the files that were passed as arguments from the command line when vim was started, its mostly used when you want to scope an action to a specific set of files, such as a vimgrep search or search and replace etc May 14, 2017 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .