Vim/Vi are popular command-line text or code editors. As a command-line text editor, the vi/vim should be used with commands. While using a GUI-based text editor going end of the files is easy by scrolling down with a mouse but it is different in vi/vim editor as there is no scroller. Vi/vim provides some shortcuts and commands in order to navigate to the end of the current file. We can also call this moving or jumping at the end of the file.
Jump End of the File
Using G Key Shortcut
In order to jump to the end of the file, the
G key is used. Keep in mind that it is capital G . Before pressing the G in order to prevent errors and change to command mode please press
ESC + G
Using ESC+CTRL+END Keys
ESC+CTRL+END key combinations can be used to jump the end of the file. There is a little difference with the ESC + G where ESC+CTRL+END key combination will put the cursor to the end of the last line.
ESC + CTRL + END
Using ESC+G+A Keys
If you want to jump end of the file and append some text you can use the
ESC + G + A where A refers to the append mode. It will jump to the end of the file and change to the append mode where you can put or add some text.
ESC + G + A
$ dolar sign depicts the end of the file. It can be used as a command which moves the cursor to the end of the file. First press ESC and then type the following command.
Jump Start of the File
The reverse of the jumping end of the file is jumping to the begging of the file. The command is very similar where
1G can be used to jump to the start of the file.
ESC + 1G
or alternatively, the
gg lower case can be used
ESC + gg