Hi I'm new to vim and I don't know what buffers and windows are. I can't find any tutorials on how to understand these two, so here are my questions:
Buffers in vim are the in-memory text of files. Your window is a viewport on a buffer. You can switch between open buffers, this is similar to tabs in other editors. Vim does have a concept of tabs too, but they are slightly different, read more about tabs in the Windows section.
A screen buffer is a two-dimensional array of character and color data for output in a console window. A console can have multiple screen buffers. The active screen buffer is the one that is displayed on the screen. The system creates a screen buffer whenever it creates a new console.
A Vim Window is what you see and interact with. A Window always shows a Buffer, being it from a file or just an empty one. Many windows can be opened at the same time by splitting the editor. Ctrl-w s , :split [filename] split the window, optionally opening a new file.
^Wc (or :close[!] ) closes the current window. If the hidden option is set and this is the last window referencing this file, Vim closes the window and the buffer is hidden. If this window is on a tab page and is the last window for that tab page, the window and the tab page are closed.
does this answer your question?
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.
A window is a viewport onto a buffer. You can use multiple windows on one
buffer, or several windows on different buffers.
A buffer is a file loaded into memory for editing. The original file remains
unchanged until you write the buffer to the file.
I think the best tutorial is vim's help file.
EDIT
the above help info you could find by :help window
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With