In other editors tabs are proxies for files. In Vim they are collections of windows. In other editors each tab represent one file. This method usually is not scalable. It's difficult to find a tab when you open a lot of them. In Vim each file is represented by a buffer. You can use one window or more to show parts of it. You can organize windows in a tab. Each tab may have its own working directory (using :tcd command). For more information you can read these links:
For more information run :h windows.txt.
CTRL-w s in normal mode:split in command modeCTRL-w v in normal mode:vsplit in command modeCTRL-w q in normal mode:q in command modeYou can create a new window using :new which will be opened horizontally or :vnew which will be opened vertically
Press CTRL-w t in normal mode
Press CTRL-w b in normal mode
CTRL-w KNote that K is uppercase. Move the current window to be at the very top, using the full width of screen. In other words if we have two vertically-splitted Windows, this command makes them horizontally splitted.
CTRL-w JNote that J is uppercase. Move the current window to be at the very bottom, using the full width of screen. In other words if we have two vertically-splitted Windows, this command makes them horizontally splitted.
CTRL-w HMove the current window to be at the far left, using the full height of the screen. In other words if we have two horizontally-splitted windows, this command makes them vertically splitted.
CTRL-w LMove the current window to be at the far right, using the full height of the screen. In other words if we have two horizontally-splitted windows, this command makes them vertically splitted.
CTRL-w TIf we have more than one window in the current tab, moves the current window to a new tab.
CTRL-w oMake the current window the only one on the screen. All other windows are closed.
Unlike other editors, tabs are different in Vim:
For a good explanation you can read these Stack Overflow post 1, post 2 and this Wiki page.
You can use CTRL-6 or CTRL-^ or :e # to switch to alternate buffer. Mostly the alternate buffer is the previously edited file.
Use :ls or :buffers or :files to see the list of buffers. You can use :ls! to include unlisted buffers (e.g. :h windows opens windows.txt and puts the corresponding buffer in the unlisted).
You can use :bdelete or :bd to delete a buffer and move it to unlisted (you can still see it using :ls!). The argument is buffer number or buffer name. You can also use a range (e.g. :5-10bd deletes buffers in the range [5, 10] or :%bd deletes all buffers).
You can use :new to split the current window horizontally with a new buffer. If you want to split it vertically, you should use :vnew.
You can read this Wiki page for more tips.
Let's say you want to read about windows but you don't want to pollute the current tab:
:tab help windows
:tab h windows
You can use :tabclose to close a tab page with all its windows.
You can use :tab split to open a new window on a new tab that shows the current buffer. Note that a diff view of two or more buffers is local to the tab page. Now you can use :DiffOrig to see the differences.
If you remove 'tabpages' from sessionoptions (:set sessionoptions-=tabpages), then you can save the current buffer list as well as other settings using :mksession ~/my_project.vim. When you start Vim later, you can use :source ~/my_project.vim to restore it.