Using a split window in vim

Blatantly stolen from

You can view the same file in multiple windows using split command:

To move between the panes you must press Ctrl+W twice. If you have one file loaded into vim and want to edit a second file in a separate window, you can split the screen horizontally with the other file loaded in the second pane:

:split file2

To set a specific height of the newt window use numberic prefix before the split command:

:10split /etc/fstab

If you wanted to close the split window, you would focus on it by pressing Ctrl+W and then entering


Better yet, after comparing something or getting a filename straight, you can close all the other split windows and just have the current window open by entering the following: