33

Here's an answer I want about 5 times a day.

In vi, the command to go to the end of the file is G.

But that always leaves me at the start of the last line of the file, if files don't have a blank line at the end.

How can I jump to the end of the file and append a new blank line, so that I can just start typing?

Thanks!

Richard
  • 1,015

3 Answers3

61

What about Go, successively? ;-)

akira
  • 63,447
binfalse
  • 1,832
4

An alternative with command line:

:$put _

If you want to understand that, you can also read this answer on registers

Benoit
  • 7,113
1

One way to do this is to create a macro and place it in your .vimrc file.

map , GA<enter>

This will map the comma key. When pressed, vi will go to the end of the file, go to the end of that line and create a new blank line. This will also leave you in insert / edit mode.

jftuga
  • 3,265