Created: 2012-12-02 — modified: 2012-12-02 — tags: vim fun
I noticed that there are quite few posts on the Internet about ggdGZZ (or ggdG:wq!, which is effectively the same). As a second-time Vim newcomer, I feel obliged to make a post about it. Command explanation:
ggdG clears current buffer:
- gg — go to first line
- d — delete to...
- G — last line
- :wq! or ZZ saves current buffer and closes it, leaving no way to undo.
Pro Tip: don't use <Caps Lock> button to start writing capital letters — some nerds like to remap it to something else.
Super-pro tip: if you're Pro Vim user having Vim newbie nearby, use ggg?G on him, optionally followed by ZZ. It's much less destructible — same command returns text back to readable form.