Ctrlw1w switches to the first window.
If currently I frequently edit in two of several windows, a shortcut for switching back to the last active window would be perfect.
Is there such a shortcut?
To move from the current Vim window to the next one, type CTRL-W j (or CTRL-W <down> or CTRL-W CTRL-J).
Ctrl-w = tells Vim to assign an equal number of lines to each viewport. To move between the viewports while working, use Ctrl-w j to move down, and Ctrl-w k to move up. This should prove easy to remember — Ctrl-w for “window” commands, and the normal vi movement commands j for down and k for up.
Like a web browser, you can go back, then forward: Press Ctrl-O to jump back to the previous (older) location. Press Ctrl-I (same as Tab) to jump forward to the next (newer) location.
did you try
<c-w><c-p>
?
from help:
CTRL-W p *CTRL-W_p* *CTRL-W_CTRL-P*
CTRL-W CTRL-P Go to previous (last accessed) window.
*CTRL-W_P* *E441*
CTRL-W P Go to preview window. When there is no preview window this is
an error.
{not available when compiled without the |+quickfix| feature}
As Kent said
<c-w><c-p>
will go to previous
You can also navigate between windows using the directions h, j, k, and l
<c-w><c-h>
<c-w><c-j>
<c-w><c-k>
<c-w><c-l>
<number><c-w><c-w>
will navigate to a specific window
You can build your own short mapping; Vim is infinitely flexible in this regard. For example, many find these useful:
:noremap <C-j> <C-w>j
:noremap <C-k> <C-w>k
:noremap <C-h> <C-w>h
:noremap <C-l> <C-w>l
Also, learn how to look up commands and navigate the built-in :help
; it is comprehensive and offers many tips. You won't learn Vim as fast as other editors, but if you commit to continuous learning, it'll prove a very powerful and efficient editor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With