Split screens in vi/vim

From microshell.com

This is pretty simple to do. It’s also very usable if you just want to compare 2 files or different sections on the same file. Here’s what you do while in vi or vim.

Split screen horizontally


The above code will split vi horizontally like the screenshot below. You can also supply an optional filename. If you do, it’ll open new file on the second window.

vi horizontal split

Split screen vertically


Unsurprisingly, the above code will split vi vertically like the screenshot below. Just like :split command above, :vsplit will also take optional filename that if supplied will open the named file on the new screen instead.

Vertical split in vi

Navigating between screens

Navigating between split-ed screens is pretty easy in vi. Just type ctrl-w ctrl-w (that is twice ctrl-w) to jump between screens. You can also use ctrl-w then arrow key to move to different screens. This is useful if you split screens into more than 2 like below.

vi 3 split screen

There you have it. And as always, I welcome comments / questions / critics that will help me and other readers understand better.


I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.