Live data from Hacker News

Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

news.ycombinator.com

21–30 of 279 posts

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#21

Keybinds (in normal mode): Shift + ZZ -> :x (save only if needed and quit) Shift + ZQ -> :q! (quit without saving)

I always preferred these over the :wq! And :q!, but for some reason seem way less popular. Most tutorials don’t even mention ZZ and ZQ.

If you’re learning Vim, command mode instructions are a LOT better because they actually show up on the screen.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#26

Keybinds (in normal mode): Shift + ZZ -> :x (save only if needed and quit) Shift + ZQ -> :q! (quit without saving)

I like to add:

Shift + ZA -> :up (save only if needed without quitting.)

by adding to your .vimrc:

    nnoremap ZA :update

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#28
Maybe it's just me, but I find :wq a lot easier to type... For :x (or worse, ZZ), I either have to move my hand or bend my ring finger/pinky to reach the keys. On the other hand, my fingers reach both w and q at the same time with very little effort.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#29

Why would it write if no changes have been made?

Vim is from an era when software was written to do exactly what you commanded it, not what you intended. It was your responsibility as a user to learn how to turn your intentions into commands.
Post reply on HN