Create a tab
Use: Tabe
Command and file name parameters, you can open the specified file in the new tab. You can also use: Tabnew
Command to edit the new file in the new tab. Command: Tab split
The file in the current buffer is opened in the new tab.
Command: Tabf
You can search for files in the current directory and open them on the new tab. For example, if you want to open the img.txt file under the current directory, you can use: Tabf IMG .*
Command. Note that this command can only open one file. If Multiple matching files are searched, you will be prompted "too many file names". In this case, you need to provide more accurate search conditions to open the file.
By default, VIM can only open up to 10 tabs. You can useSet tabpagemax = 15
Change this restriction.
List tabs
Command: Tabs
The list of opened tabs is displayed, the current page is marked with ">", and the changed page is marked with "+.
Close Tab
Command: Tabc
You can close the current tab. Commands: Tabo
All tabs are closed.
Switch Tab
Command: Tabn
OrGT
You can move to the next tab. Commands: TABP
OrGT
Will be moved to the previous tab. If you have reached the last or foremost tab, the cycle is automatically switched.
If you open many tabs, you can use: Tabfirst
Or: Tabr
Command to move to the first tab. Use: Tablast
Command to move to the last tab.
Move Tab
If you want to arrange tabs in the specified order, you can use: Tabm
Command. Note that the order of tabs starts from 0. For example: Tabm 1
The current tab will be moved to the 2nd position. If you do not: Tabm
Command to specify parameters, the current tab will be moved to the end.
Configuration tab
By default, the tab bar is displayed at the top of the window only when a new tab is created.Set showtabline = 1
. If you want to always display the label bar, you can useSet showtabline = 2
Command. You can useSet showtabline = 0
.
Multi-tab command
Use: Tabdo
Command, we can execute the command in multiple tabs at the same time. For example, if you open multiple tabs and replace "food" in these files with "drink", you can use: Tabdo % S/food/drink/g
Command to replace all files at a time, instead of repeating operations on each file.
Graphic Interface
If you are using gvim with a graphical interface, you can right-click the tab to create, close, and open a tab. You only need to click the corresponding tag to switch between different tabs.
Pass: Help tab-page-intro
Command to obtain more information about the use of tabs.
Command Summary
: Tabnew |
Create a tab |
: Tabs |
Display the list of opened tabs |
: Tabc |
Close current tab |
: Tabn |
Move to the next tab |
: TABP |
Move to the previous Tab |
: Tabfirst |
Move to the first tab |
: Tablast |
Move to the last tab |