vi/vim 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 as moving or jumping at the end of the file.
Jump End of the File
In order to jump to the end of the file the
G 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
ESC+CTRL+END key combinations can be used to jump end of the file. There is a little different with the ESC + G where ESC+CTRL+END key combination will put the cursor to the end of the last line.
ESC + CTRL + END
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
Jump Start of the File
The reverse of the jumping end of 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