← All lessons

12. Windows

Step 5 of 9

The most important thing to remember

I want you to remember one mapping for practically all window operations in Vim: <C-w> (control W) in normal mode.

But before we continue, a small warning: if you’re on an operating system where <C-w> closes the current browser tab (like Windows), don’t press it — you’ll end up closing the current lesson! I would recommend setting up a new map to <C-w> inside the editor so that you can continue this lesson without disruption. Something like :nnoremap W <C-w> should do the trick, which will map the W (shift w) key to function the same way as <C-w>. It’s a bit of a kludgy work around… but I haven’t figured out a way to get it working just yet!

With that out of the way, let’s get on with the lesson.

Using <C-w> in normal mode, you can:

… basically everything you’ll ever need!

Let’s try some <C-w> maps in the editor! We already know how to create new windows with the :split and :vsplit commands — and we also know that we can use :q and :close to close any windows that we no longer need. This time, instead of using the commands, lets use the <C-w> maps instead.

We’re going to create and close some windows as before, but this time:

Loading editor…