Editing multiple buffers with vim

Editing multiple buffers with vim

Starting vim

To edit multiple files within a single vi session, you either list the files on the command line, or use the buildin command next: ":next next_file.txt"

Switching buffers

To list all current buffers use the :ls command. Switching to a given buffer is done via ":buffer #" or for short ":b #", with # representing the buffer number.
Often the buffer that you want to edit is the buffer that you have just left. Vim provides a couple of convenient commands to switch back to the previous buffer. These are (or ) and :b#.
Both of these technically edit the alternate file, although this is usually the previously edited buffer.

see this link for more information about multiple buffers/windows in vim.

copyright © 1997-2021  Oliver Schroeder (remove XYZ)