ZZ

I was at a VimGolf evening at Vim London a few months ago, and one thing I picked up there was the use of ZZ. If you look at VimGolf solutions, a lot use ZZ to write and close the file. If multiple windows (split buffers) are open, it'll write and close that window. If you're in Normal mode, this is shorter than typing :wq.

There's also ZQ, which quits without saving changes. ZQ is equivalent to :q! rather than :qa!, which quits all windows and Vim entirely.

I like these marginally more efficient ways to quit Vim -- I use ZZ more than :wq or CTRL-W c (which just closes a window). Vim's documentation covers all of these commands and more under Writing and quitting (:help write-quit).

blog comments powered by Disqus