Learn Practice Daily golf Reference

How to go to the end of a file in Vim

In Normal mode, press G to go to the last line of the file and gg to go to the first. As commands, :$ and :1 with ↵ do the same.

Try it here

Finish the checklist

Add a last item at the bottom with G and o, then go to the top with gg and add to the title with A.

1 of 2G, then o, type "- Publish to npm" and Esc
3# Release checklist
2
1- Run the tests
4- Bump the version
1- Update the changelog
2- Tag the release
+- Publish to npm
NORMALLoading the editor…1/20.0s4:1

This editor needs a keyboard. Read on, and play it at your computer.

KeysWhat it does
GGo to the last line.
ggGo to the first line.
:$ ↵ / :1 ↵The same, typed as commands: $ means the last line.
G$Go to the very last character of the file.
Go / ggOOpen a new line below the last line / above the first, in Insert mode.
dGDelete from this line to the end of the file.
dggDelete from this line to the top.
yG / yggCopy from this line to the end / to the top.
ggdGDelete every line in the file (:%d ↵ does the same).
gg=GRe-indent the whole file.
Before
## Install
npm install
## Old notes
Moved to the wiki in March.
See the wiki for the link.
dG
## Install
npm install
dG deletes from the cursor's line to the end of the file, whole lines, wherever the cursor is on the line

G and gg as motions

G and gg are motions, so they work after any operator, and they always take whole lines. dG deletes from the line you are on to the last line, yG copies the same lines, and >G indents them. Put gg in front and the operator covers the whole file: ggyG copies everything, ggdG empties the file. The command-line versions are :%y and :%d, where % means every line.

Both are also jumps, so Vim remembers where you were. After a quick look at the end of the file with G, two backticks, ``, bring you back to the exact spot you left.