How to effectively add a file to the args list for vim from within vim?

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 :

Summary:
- 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.

Tags:

Vim