Step 3 of 6

13. Tabpages

Moving between tabpages

We’ve just learned how to create new tabpages. But that’s not much use without knowing how to move between them!

Moving between tabpages is really easy in Vim. You can use:

  • gt to go to the next tabpage
  • gT to go to the previous tabpage
  • [count]gt to go to the [count]’th tabpage — e.g. 2gt takes you to tabpage number 2

Let’s try this in the editor. Work through the checklist below. Open two new tabpages with the :tabnew command, writing a short label inside each one so you can tell them apart. Then, switch between them with gT, gt, and [count]gt. As you move through them, you’ll notice that the highlighting on the tabline at the top changes to reflect which tabpage you’re currently on.

  1. Create a tabpage labeled two Run :tabnew, then give the new buffer a label — press i, type two, and press Esc.
  2. Create another, labeled three Same again — run :tabnew, press i, type three, and press Esc.
  3. Go to the previous tabpage The tabline highlight hops left, back onto the buffer labeled two — press gT.
  4. Go to the next tabpage And back to the right, onto three — press gt.
  5. Jump to tabpage 2 by number A count picks the tabpage directly — press 2gt to land on two in one hop.
Create a tabpage labeled two Run :tabnew, then give the new buffer a label — press i, type two, and press Esc.

Next: Create another, labeled three

Loading editor…