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

How do I jump to the previously active window?

Answer

<C-w>p

Explanation

The <C-w>p command jumps to the previously active window (the last window you were in). It is like Alt+Tab for Vim windows.

How it works

  • <C-w>p switches to the previous window
  • Pressing it again switches back
  • Toggles between two windows

Example

With multiple splits open, switch from code to terminal window with <C-w>p, check output, then <C-w>p back to code.

Tips

  • More efficient than <C-w>w when you frequently switch between two specific windows
  • Only tracks the most recent previous window
  • <C-w>w cycles through all windows sequentially
  • Combine with <C-w>P (capital P) to jump to the preview window
  • <C-^> is the buffer equivalent (switches between current and alternate buffer)

Next

How do you yank a single word into a named register?