[Note: “Alternative” Vim users (e.g. Emacs/Evil users), skip to the bottom]
Today we’re going to do something a little different. There are many excellent online resources for learning just about anything Vim-related. But as you gain more experience with Vim, it will become worthwhile to have at least basic familiarity with using Vim’s built-in help features, since, in the spirit of efficiency, they can sometimes be the fastest way to learn about something (e.g. “What does the r
key do?” :h r
), and in the spirit of mastery (so I’m told), they can be the best way to learn about something in-depth.
Since scrolling is a basic and well-bounded function, it’s a good one to learn using the built-in help as a way to get oriented with this facility. But first, let’s get a sense of what help looks like. Give this one a quick read:
:help
— Learn about help
A few more stops on the help tour:
:help intro
— An introduction to Vim written by Bram Moolenaar himself:help tutor
— Learn about Vim’s built-in “first steps” tutorial (which you should consider going through, if you haven’t already):help user
— Vim user manual (narrative documentation):help reference-toc
— Vim reference manual (technical documentation)
And now, without further ado, let’s learn about scrolling! This should tell you everything you need:
:h scrolling
[SPOILER ALERT: you may want to go through the above steps before continuing]
For the benefit of those who are learning Vim but are not actually using Vim itself but one of the many “Vimlikes”1 (such as Emacs’s Evil or Sublime’s Vintageous), and who don’t have immediate access to Vim help, here are my go-to scrolling commands:
Scroll window up / down half a page — C-u C-d
Scroll forward / backward a full page — C-f C-b
(I prefer half-page since it preserves some context)
Scroll window down / up one line (retaining cursor) — C-e C-y
(I use these often)
Recenter view on cursor — zz
(note this is lowercase)
Note that these simply move your “view” of the buffer — they are not cursor motions that can be combined with verbs.
1 Vimlike: A program that reflects the essence of Vim without necessarily being Vim itself. This term could be taken to encompass Vim, NeoVim, Emacs Evil, VSCodeVim, among others. The term was chosen to resemble roguelike.