Vim / Vi Page Up and Down Controls

Vim / Vi Page Up and Down Controls

While the most intuitive way to navigate around the terminal may be scrolling and using the arrow keys, Vim offers multiple shortcuts to move around the screen. Paging up and down with keyboard shortcuts is one of the most efficient and flexible ways to hop around. To start, make sure that you are not in Insert mode and that you are in Normal mode by pressing [.inline-code]ESC[.inline-code].

[#page-up-and-down]Page up and down[#page-up-and-down]

A page is considered to be the screen size of your terminal. The following commands will move the page up and down based on the current screen size.

  • [.inline-code]ctrl + b[.inline-code] to move a page screen back or “up”
  • [.inline-code]ctrl + f[.inline-code] to move a page screen front or “down”
  • [.inline-code]ctrl + u[.inline-code] to move a ½ page screen up
  • [.inline-code]ctrl + d[.inline-code] to move a ½ page screen down

[#row-up-and-down]Row up and down[#row-up-and-down]

To move up and down a single row instead of a whole page:

  • [.inline-code]j[.inline-code] to move 1 line down
  • [.inline-code]k[.inline-code] to move to move 1 line up

Similar to how you navigated to specific rows, we can leverage this command to move up and down multiple rows.

  • [.inline-code]2j[.inline-code] to move 2 lines down
  • [.inline-code]2k[.inline-code] to move 2 lines up


As an engineer, I use the above commands when I’m reading through code and don’t care about cursor placement. The above commands can move the screen so that I can read my entire file, but they also alter my cursor location. When I’m writing code and want to understand related functions, I tend to use other commands to keep my cursor in place. As long as my cursor does not go off-screen, I can remember my current spot while reading through the file.

  • [.inline-code]ctrl + y[.inline-code] to move the screen up one line
  • [.inline-code]ctrl + e[.inline-code] to move the screen down one line
  • [.inline-code]z + z[.inline-code] to move the current line I’m on to the center of the screen
  • [.inline-code]z + t[.inline-code] to move the current line I’m on to the top of the screen
  • [.inline-code]z + b[.inline-code] to move the current line I’m on to the bottom of the screen

[#other-ways-to-vim]Other ways to Vim[#other-ways-to-vim]

This post lists out just a couple of ways to navigate your terminal using Vim like viewing pages and rows. A related way to navigate is to use vim to go to the beginning and end of the file. Learning how to navigate is just the beginning: with vim, you’re able to copy and paste, undo and redo, and delete line(s) all with just a few keystrokes.