← All lessons

12. Windows

Step 3 of 9

Two windows, one buffer

I mentioned in the last section that :split and :vsplit accept a filename. But it turns out that this filename is actually optional!

If you don’t specify a filename and just run :split/:vsplit, you’ll split the current window into two — leaving you with a new window that’s peering into the same buffer!

Interesting! You can have multiple windows that are “looking at” the same buffer. This can be really useful: in a large file, you can keep two far-away sections visible on-screen at the same time.

Try it in the editor! Use the :split or :vsplit commands on their own to create a bunch of windows all peering into the demo buffer. Then, try making an edit to the buffer. You’ll see that your change is reflected in all of the windows.

Loading editor…