By Alvin Alexander. Last updated: August 5, 2017
Vim FAQ: What is the Vim “go to line number” command? (Or, how do I go to a specific line number in vim?)
In short, you use the capital letter G
in Vim command mode to move to a specific line number. Here are several Vim goto line number example commands:
G - go to the last line in the vim editor (last line in the file) 1G - goto line number 1 20G - goto line number 20
As you can see, you just specify the desired line number before the capital letter G
, and vim will take you to that line. The exception to that rule is typing G
by itself, which takes you to the last line in your vim file.