G VIM Command

How to use G Command in Linux VIM editor?

Explanation


This command is used to move the cursor to last line of the file.

Usage:

G

Example:

  • Open the file test.txt
    $ vim test.txt
  • You can view that the cursor is now focussed in the second line

  • To move the cursor to last line of the file
    Press G
    G VIM Command
  • To move the cursor to beginning of the second line in the file
    Press 2G
    Move Cursor to Last Line VIM

Ask Questions

Ask Question