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>pswitches 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>wwhen you frequently switch between two specific windows - Only tracks the most recent previous window
<C-w>wcycles 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)