- Mastering Vim
- Ruslan Osipov
- 299字
- 2021-06-10 18:51:29
Tabs
In many modern editors, tabs are used to represent different files. While you can certainly do this in Vim, you might want to consider their original purpose.
Vim uses tabs to switch between collections of windows, allowing you to effectively have multiple workspaces. Tabs are often used to work on a slightly different problem or set of files within the same Vim session. Personally, I don't get a lot of use out of tab pages, but if you find yourself often switching context within the project or between projects, then tabs might be exactly what you're looking for.
You can open a new tab with an empty buffer as follows:
:tabnew
As you can see, tabs are displayed on the top of the screen. The tab labeled 3 farm.py is a tab with three open windows and an active buffer farm.py. The [No Name] tab is the one we just opened:

You can load a file in it in the usual way: :e <filename>. You can also switch to a desired buffer using the :b command.
To navigate between tabs, you can use the following:
- gt or :tabnext to move to the next tab
- gT or :tabprevious to move to the previous tab
The tabs can be closed using :tabclose or by closing all of the windows it contains (for example, with :q if it's the only window).
:tabmove N lets you place the tab after the Nth tab (or as a first tab if N is 0).
- Unity 2020 By Example
- HornetQ Messaging Developer’s Guide
- Monkey Game Development:Beginner's Guide
- Access 數據庫應用教程
- 網頁設計與制作教程(HTML+CSS+JavaScript)(第2版)
- Servlet/JSP深入詳解
- C/C++常用算法手冊(第3版)
- 微信公眾平臺開發:從零基礎到ThinkPHP5高性能框架實踐
- C語言實驗指導及習題解析
- Java EE 8 Application Development
- C語言從入門到精通
- Citrix XenServer企業運維實戰
- 持續集成與持續交付實戰:用Jenkins、Travis CI和CircleCI構建和發布大規模高質量軟件
- Visual Studio Code 權威指南
- Maven for Eclipse