I have a file opened with vim, how do I keep the top 10 header lines at the top all the time while I scroll down the page?
Asked
Active
Viewed 274 times
2 Answers
3
Try
esc : 10 sp
ctrl-w to switch between.
They are referred to as viewports in vi parlance.
dmourati
- 25,870
1
The keystrokes ctrl-w s will split the screen horizontally, and ctrl-w ctrl-w will switch your focus back and forth. You can widen the current viewport with ctrl-w +, or make is smaller with (any guess?) ctrl-w -.
You can do vertical splits with ctrl-w v, and you can split a split to make fairly complex sets of viweports inside the vim screen.
Using :q will close your current viewport.
Shannon Nelson
- 289
splitcomand (spis short forsplit) is specific tovim. These days it's a pretty safe bet that you if you're on a Linux system you are runningvim, but it's worth noting that if you find yourself on a system with vanillavi(FreeBSD, Solaris) that this won't work. – larsks Jun 16 '11 at 02:39