How to move cursor to end of file in Vim / Vi text editor
How to move cursor to end of file in Vim or Vi text editor
Move cursor to end of file with Vim / Vi text editor
Vim is a popular text editor that is pre-installed on macOS, Linux Distros, and BSD Like operating systems. Vim is a free and open source text editor currently available. Whenever you use Vim, you need to jump to a specific line number or end of file. In this tutorial, you will learn how to move the cursor to the end of the file with the Vim / Vi text editor.
How to jump to end of file in Vim
If you are in another mode, press Esc
The normal mode is set.
Now you can press G
To move to the end of the file:
G
Press to go to the first row gg
Key:
gg
How to move the cursor to a specific line number
If you are in another mode, press Esc
The normal mode is set.
Moving the cursor to a specific line number in Vim or Vi is easy. To move the cursor to a specific line number, type after the line number G
Key:
For example, to go to line number 12, you can enter the following command:
12G
Similarly, to go to line number 57, you can enter the following command:
57G
You can also move to the first line by entering the following command:
1G
Conclusion
In this tutorial, you learned how to move the cursor to the end of the file with the Vim / Vi text editor. If you have any questions about this, please comment below.