Move End Of Line In Vim/Vi

Vim or Vi is a command-line text editor which is very different from most of the popular text editors which are GUI based. For GUI based text editors generally, a mouse pointer is used for navigation over file like jumping end of the file. Vim or Vi uses different commands and keys for navigation.

End Of Line Key Shortcuts For Vim/Vi

You can use the following table in order to move end of line of different lines.

KEY SHORTCUTSDESCRIPTION
$Move end of the current line.
gg$Move the end of the first line.
G$Move the end of the last line.
11G$Move the end of the line number 11

Move End Of Current Line

Vim provides the key for the move or jump end of the line. Take the following steps to jump to the end of the current line. The current line is the line where the cursor is located.

  • Press the ESC key.
  • Press $ (dollar sign) in order to move the end of the current line where the cursor is located.

Move End Of First Line

We may need to end the first line from anywhere in the file. Even the cursor is located end of the file you can move the end of the first line with the following steps.

  • Press the ESC key.
  • Press gg to move the first line and press $ to move the end of the line.

Move End Of Last Line

We may need to end the last line from anywhere in the file. Even the cursor has located the start of the file you can move the end of the last line with the following steps.

  • Press the ESC key.
  • Press G to move the last line and press $ to move the end of the line.
READ  Linux rm Command Tutorial

Move End Of Specified Line

We can also move any of the specified line number ends of the line. Just follow these steps. In the following example, we will move the end of line number 11.

  • Press the ESC key.
  • Press 11G to move the last line and press $ to move the end of the line.

Leave a Comment