How do I jump directly to a specific tab page by its number in Vim?
Answer
{count}gt
Explanation
Prefixing gt (go to next tab) with a count jumps directly to the tab page at that position. For example, 3gt moves to the third tab page, regardless of where you currently are. This is faster than pressing gt or gT repeatedly when you have many tabs open and know which one you want.
How it works
gt— move to the next tab page (wraps around)gT— move to the previous tab page{N}gt— jump directly to tab page N (1-indexed from the left)
Tab pages are numbered starting from 1. If you type 1gt, you jump to the first tab; 5gt jumps to the fifth.
Example
# You have 4 tabs open: [1] routes.rb [2] schema.rb [3] user.rb [4] spec.rb
# Cursor is on tab 1
3gt → jumps directly to tab 3 (user.rb)
1gt → jumps back to tab 1 (routes.rb)
gT → would step backward one tab at a time
Tips
- The tab number is shown in the tabline at the top of the screen
- Use
:tabsto list all open tab pages and see their numbers {N}gTdoes NOT jump to tab N — it moves backward by N tabs from the current position- For named navigation,
:tabnext {file}and:tabfind {pattern}are alternatives