---
title: "Multiple Windows"
url: "https://courses.osherove.com/courses/vim-hates-you/multiple-windows.md"
canonical: "https://courses.osherove.com/courses/vim-hates-you/multiple-windows/"
tags: []
author: "Roy Osherove"
description: "Lesson 13 of 26 in Vim Hates You (Divide & Conquer your windows), 3:07. Free video by Roy Osherove."
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Multiple Windows

1. [Courses](https://courses.osherove.com/#courses)
2. [Vim Hates You](https://courses.osherove.com/courses/vim-hates-you/)
3. Divide & Conquer your windows

Lesson 13 of 26

Duration: 3:07 [Watch on YouTube](https://www.youtube.com/watch?v=p5gXmwayOxQ)

## In this lesson

Roy opens a second file next to the current one with vsplit (split adds a horizontal window instead) and moves between windows with Ctrl-W followed by h, j, k or l. He closes a window with q or keeps only the current one with only. On a Mac he recommends turning Caps Lock into Control under the keyboard settings' modifier keys, so that Control is easier to reach.

## Transcript

446 words

[\[00:07\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=7s) At this point, we've only been working with a single file each time. So, I want to show you how to work with more than one file at the same time or having more than file one file open and visually visible at the same time. And there are many concepts in Vim such as buffers and windows. I'm going to show how to have multiple windows in Vim. And the command to do this is to either use split or vsplit. So split will have a horizontal window and vsplit will add a vertical window.

[\[00:38\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=38s) So let's say I want to edit my vimrc on the side here. I'm going to type command here at the bottom vsplit and the name of the file. So home vimrc. And now I have two files. Now the question is how do I move from one file to another? The answer is that you use control W to say window and then you move right or left.

[\[01:09\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=69s) So you can move right or left either with H or L or J and K if the window is below or above you. So here I'm going to do if I want to move right I'll say control W and then L to move right. WH to move left. And usually it just a very quick syntax. I'm going to try to type it actually very strongly so you can hear how fast it goes

[\[01:47\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=107s) Now let's say you want to close. You either type Q on the current file like this and you're left with just one of them. Or if I just repeat this, you can type only to remain the only file open. So I'm going to move to the file I want to have open. So now I am in the in this file. I'm going to type command sorry command only.

[\[02:17\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=137s) This remains the only window. So that way you don't have to close multiple windows if you have more than two open. So those are really really basic steps in working with multiple windows. Now if you're in a Mac just like me and one of the things that is very highly recommended is to transform the caps lock into a control. So it's much easier to type control. And the way you do that is in the keyboard settings under keyboard you can click modifier keys

[\[02:48\]](https://www.youtube.com/watch?v=p5gXmwayOxQ&t=168s) And then there either your internal or your external keyboard you change caps lock to also be control and that way it's actually much easier to reach with your left pinky to the control instead of going down. So, it's much easier on your hands that way.

[Previous lesson Vim Shortcuts in Bash and ZSH](https://courses.osherove.com/courses/vim-hates-you/vim-shortcuts-in-bash-and-zsh/) [Next lesson Vim Tabs](https://courses.osherove.com/courses/vim-hates-you/vim-tabs/)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
