Lesson 14 of 26
Vim Tabs
In this lesson
Roy opens a new tab with tabnew, writes a file in it, and moves to the next tab with gt and to the previous one with g and uppercase T; recent versions also accept Ctrl-Page Up and Page Down. He closes a tab with q, opens a file in a new tab by giving tabnew a file name, or uses tabfind, which searches the Vim path. He adds that some people prefer tabs to windows or buffers.
Transcript
[00:06] (external link, opens in new tab) Other than Windows, Vim also has the notion of buffers and and it also has the notion of tabs. So today we're going to look at tabs. And tabs basically mean kind of looks like a tabbed interface. And the way you work with tabs, one of the easiest way to work with it is to go to command mode here at the bottom. Type tab new. And here we have a new tab. It doesn't have any file yet. So technically I could just press I to go to insert mode. This is a file in a new tab.
[00:37] (external link, opens in new tab) Escape. And then I'm going to write with the file name file 2. And now I have these two tabs. And if I want to move to the next tab or the previous one, I'll do GT to move to the next tab. again GT GT or I can press G and uppercase T to move previous tab. In recent VI versions you can also do control page up and down to move between tabs.
[01:08] (external link, opens in new tab) And if you want to close a tab, it's very easy. You simply say command sorry go to command and Q for quit. Now our tab is closed. We can also open a tab by just specifying the file name by saying tab new and then file 2. And here I have my tab open. Or I could do a command tab find and then my file 2 and it will search in the vim path which is defined in a vimrc sometimes or in the default vimrc files which I'll explain in different videos.
[01:52] (external link, opens in new tab) So that's it. Working with tabs is pretty easy. Some people like it way more than working with different window windows or just buffers. A buffer is inside a tab but it's visually different. So you can switch between buffers just by switching between different tabs.