Go to first line in a file in vim?
VimEditorLineVim Problem Overview
How do I go to first line in a file in vim ?
Vim Solutions
Solution 1 - Vim
In command mode (press Esc if you are not sure) you can use:
- gg,
- :1,
- 1G,
- or 1gg.
Solution 2 - Vim
Type "gg" in command mode. This brings the cursor to the first line.
Solution 3 - Vim
Go to first line
-
:1
-
or
Ctrl + Home
Go to last line
-
:%
-
or
Ctrl + End
Go to another line (f.i. 27)
:27
[Works On VIM 7.4 (2016) and 8.0 (2018)]
Solution 4 - Vim
If you are using gvim, you could just hit Ctrl + Home to go the first line. Similarly, Ctrl + End goes to the last line.