From the course: Learning Vim

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Windows and buffers

Windows and buffers - vi Tutorial

From the course: Learning Vim

Start my 1-month free trial

Windows and buffers

- [Instructor] It's very common to work on more than one file at a time. Vim supports editing multiple files as well. But you need to understand the terminology of it. A buffer is the content of the file being edited. It can be a new file, or a file that's already exists on disk. All the changes you are doing to a buffer will only be written to disk if you save the buffer. A window is a view to a buffer. You can have several windows pointing to the same buffer in different places. Let's have a look. Vim perfect.txt. Now open a new window to the same buffer with :split. Say you'd like to add where the first quote came from. Find the location with /P enter and move to the end of the file with dollar and enter insert mode with "a". And now write. And this quote is from Zen and the Art of Motorcycle Maintenance. As you can see, the bottom window is updated as well. Let's move to the end of the current window. Escape and then Shift + G. As you can see the bottom window did not change. You…

Contents