Navigating splits

3.6
(82)

We’ve written a lot about splits, which divide your screen into either horizontal (:split) or vertical (:vsplit) segments. If you’re working with only two, or maybe three, open splits at once, the easiest way to navigate is with <ctrl-w> w which moves to the window below or right of the current one (or back to the top left if there nothing below or to the right).

  • <ctrl-w> w – Move to the window right or below or back to the top left

With two splits open, this will simply bounce you back and forth between them. With more open, it gets complicated. You can just remember that <ctrl-w> w will move in a z pattern across your screen. First to window A, then B, then C, then D, then back to A:

There’s also another way, which might be easier to remember and definitely works better when you have many splits open. Use <ctrl-w> plus a directional: h, j, k, or l. These shortcuts will move you left, down, up, or right across the splits in your current window.

  • <ctrl-w> h – Move to the split to the left
  • <ctrl-w> j – Move to the split below
  • <ctrl-w> k – Move to the split above
  • <ctrl-w> l – Move to the split to the right

How useful was this tip?

Average rating 3.6 / 5. Vote count: 82

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

70 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts

4 thoughts on “Navigating splits”

  1. I actually bind these commands so I can simply move around in splits using Control + Direction. I am not sure if I am overwriting some other command – I have so far not found any conflicts of sorts.

    nmap
    nmap
    nmap
    nmap

  2. Nice article.
    I have set up keyboard shortcuts to move between windows and to resize.

    ” Easy navigate the split view.
    nnoremap j
    nnoremap k
    nnoremap h
    nnoremap l

    ” Resize split windows using arrow keys.
    noremap +
    noremap –
    noremap >
    noremap <

  3. Nice tip! I, like others have mentioned, recommend rebinding. I have mine set to (Space-bar) + direction (hjkl).

Leave a reply

Your email address will not be published. Required fields are marked *