An idea for an evil prank on your Vim-loving friend. Hint: in most other editors same effect is achieved by <Ctrl+A> <Del> <Ctrl+S> <Alt+F4>">

Vim prank

Created: 2012-12-02 — modified: 2012-12-02 — tags: vim fun

An idea for an evil prank on your Vim-loving friend. Hint: in most other editors same effect is achieved by <Ctrl+A> <Del> <Ctrl+S> <Alt+F4>


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.
So next time your nerdy friend leaves Vim open and looks away for a few seconds — rush to it, smash in ggdGZZ and run away!
Pro Tip: don't use <Caps Lock> button to start writing capital letters — some nerds like to remap it to something else.
Warning! Do not do it if you're not ready to cope with consequences!

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.