Tabs in Vim

In Vim, a buffer is a file in memory. A window is a viewport of buffer. A tab is a layout of windows. Oftentimes, you would find yourself splitting the screen into multiple windows for several buffers.

However, this screen is just one tab page. To preserve the window layout, we can do :tabnew or :tabe <file>. This will create a new tab page for us, leaving the first tab page and its windows intact. You can also use C-w T on any existing window to move it to a new tab. Use gt or :tabn to navigate to the next tab page, and gT or :tabp to go back to the previous tab page.

Tabs are useful when you need to do something out of context. For instance, while you code in the first tab, you open a new tab for help with :tab help ,. You could also dedicate a tab just for diff viewing.