Have you ever found yourself going through a long file in vim and wishing you could split your screen? Perhaps you want to make some comparison with a chunk at the top of file with something in the middle. With a few keystrokes you can do exactly that.
Split Horizontally
To split the screen horizontally:
a.) Hit CTRL + w
b.) and then s.
If you want to navigate between the screen:
a.) Hit CTRL + w
b.) and then w.
To exit out of one of the screen:
a.) Go into command mode (i.e. hit ESC)
b.) and quit as usual: :q.
Split Vertically
To split the screen vertically, much like splitting horizontally:
a.) Start by hitting CTRL + w
b.) but then hit v (instead of s).
Navigating between the split screens is the same (CTRL + w + w).
Though horizontal splitting works great. I find vertical splitting to be the most useful.
Combine Both
Why choose? It is possible to combine both horizontal and vertical screen splitting as well.



Top comments (0)