My Site
The Purpose of Vim Tabs

Yesterday, after many years of using Vim, I’ve finally realized what the purpose of Vim Tabs is. My friend asked me to post this article, because she was also stumped by their functionality.

When they first came out, I tried them. I didn’t understand why they’d even put tabs in, when there are far superior ways to navigate Vim buffers, but I soon found out that tabs in Vim don’t show buffers. They show, in essence, separate instances of Vim. Buffers open in one tab will not show up in another tab. EDIT: As VimGuy points out, they do contain the same buffers. Tabs are more like separate layouts of your currently open buffers.

So what’s the point? With all the options to organize your buffers and manage your files (BufExplorer, NERDTree, split windows, etc, etc), what are the tabs useful for?

At my new job, there are 3 separate, large, codebases. Yesterday I was working in one system, coding away. Probably 20 buffers open, all related to the same project, when one of my coworkers asked me to help him in another one of our systems. I didn’t want to lose my place, or vim “state”, as it were, and intuitively I created a tab, opened up a new instance of NERDTree in this tab, and started opening new buffers related to the second system in this tab. In the first tab, all my open buffers and split windows were still there, waiting for me to get back to them.

A minute later, it suddenly occurred to me, “So THATS what Vim tabs are for.”

Filed under: Programming

From Dustin on Feb. 9 @ 1:37 p.m. 2012

Ironic, you change the name of your blog, then blog about vim tips...
From synic on Feb. 9 @ 1:46 p.m. 2012

Hah, yeah. Well, I wanted to post about more general things too, but not actually eliminate the Vim tips while I was at it :P

tl;dr: SHUSH.
From VimGuy on Feb. 12 @ 11:59 a.m. 2012

"Buffers open in one tab will not show up in another tab." -- This is incorrect
Tabs are more like different "views" of the same buffers, not like different vim instance.
From synic on Feb. 12 @ 12:07 p.m. 2012

You are right, my bad :)

Add a comment:

Optional, for comment reply notifications
Note: If you enter your email address, you will be subscribed to this article and will recieve comment updates via email. This is the only thing your address will be used for. A link will be provided at the end of each email that will allow you to unsubscribe should you need to, or you can go to to unsubscribe from any/all updates.