vimtricks.wiki Concise Vim tricks, one at a time.

How do I jump directly to the top-left or bottom-right window in a complex split layout?

Answer

<C-w>t and <C-w>b

Explanation

When managing multiple splits, <C-w>t jumps to the top-left window and <C-w>b jumps to the bottom-right window. These let you reach the extremes of your layout instantly without cycling through intermediate windows with <C-w>w.

How it works

  • <C-w>t — moves cursor to the top-left window (the root of the window tree)
  • <C-w>b — moves cursor to the bottom-right window (the last leaf of the window tree)
  • The "top-left" and "bottom-right" positions follow Vim's internal window tree, which reflects the order splits were opened
  • Both work regardless of how many windows are currently open

Example

With a layout like this (numbers are window positions):

+-------+-------+
|   1   |   2   |
+-------+-------+
|   3   |   4   |
+-------+-------+

<C-w>t takes you to window 1; <C-w>b takes you to window 4 — in a single keypress.

Tips

  • Use <C-w>t before :only to preserve the top-left window when closing all others
  • Combine with <C-w>H / <C-w>K to reorganize the layout after jumping to a corner
  • <C-w>p returns to the previously focused window if you overshoot
  • In a terminal buffer layout, <C-w>b is a quick way to re-enter the terminal at the bottom

Next

How do I configure Vim's command-line tab completion to show all matches and complete to the longest common prefix?