When you want to have an overview of a file, you can get a good overview just moving down a few pages.
To move a page down in Vim, press the
Ctrl + f key combination, and to move a page up, press the
Ctrl + b key combination.
- Ctrl+f: Page down
- Ctrl+b: Page up
If you want a more granular control, read along!
Moving Page Down
There are several ways you can move the cursor downwards in Vim.
You can move the cursor down one full screen or you can move it down only half the screen.
Page forward one screen
Page down is a common action to perform that moves down one full screen.
To move down one full screen, make sure you are in Normal mode and then press
Ctrl + f key combination.
You can remember this thinking that the 'f' in "Ctrl + f" stands for forwards.
Alternatively, you can also press the Page Down key on your keyboard (that is above the arrow keys).
This operation is also called a page forward operation.
Scroll forward half a screen
Sometimes it makes more sense to scroll down just a little bit.
In those cases, you can use the
Ctrl + d key combination. Make sure you are in Normal mode before you press this key combination.
If you have trouble remembering this key combination, you can think of the 'd' in "Ctrl + d" as downwards.
This operation is also referred as a scroll forward operation.
Moving Page Up
Just like Page Down, there are several ways you can move the cursor in the upwards direction in Vim.
Either you move it one full screen up or move it half a screen up.
Page backwards one screen
Vim allows you to go up a full screen.
To scroll up a full screen, enter Normal mode and press the
Ctrl + b key combination.
You can remember this by thinking that the 'b' in "Ctrl + b" stands for back[wards].
If present on your keyboard (usually above the arrow keys), you can make use of the Page Up keys to perform the same action as "Ctrl + b".
This operation is also called a backwards scroll.
Scroll backwards half a screen
You can move half a screen in the upwards direction in Vim.
Scrolling up half a screen can be done by pressing the
Ctrl + u key combination. Make sure you are in Normal mode before you press it, though.
If you have any trouble remembering this, think of the 'u' in "Ctrl + u" as up[wards].
This operation is referred as a backwards scroll operation.
Suggested reads 📖
This article mentions how you can scroll up or scroll down in Vim. Here are a few more related articles you should read:
- Go to the beginning or end of a file in Vim
- Go to a specific line in Vim
- Move to the start or end of a line in Vim
If you are interested in learning more than just the Vim Basics, I highly recommend using this program by Jovica Ilic.