Intro to Vim Tip #6 (Multiple viewports)
By Jesse Morgan
One feature of vim I don’t use enough is the ability to split the screen and view multiple files at once. I use this feature all the time when I use vimdiff, but not really any other time. I thought I’d take a moment to lay out some uses of it (thank Linux.com for the reference):
From Command Mode:
- :sp splits the screen horizontally
- :vsp splits the screen vertically
- Ctrl-w Ctrl-w moves between viewports
- Ctrl-w [right arrow] moves active viewport 1 to the right
- Ctrl-w [left arrow] moves active viewport 1 to the left
- Ctrl-w 3[left arrow] moves active viewport 3 to the left
- Ctrl-w q will close the active window.
and remember that you can open a file with 😮 filename in the newly created viewport