Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

:x is not only a short for :wq - the latter saves (unconditionally, even if you have saved earlier and not edited since), and then quits (the file). I was going to say that :x is also a shortcut for :q (just quit) but it is of course not a shortcut for that, since it is the same length :)

I can better describe it like this:

:x is a shortcut for telling vi/vim: save the file if not saved after last change, then quit (in either case, whether a save was needed and done just now or not) - IIRC.

Also, as others said, Shift-ZZ (when Caps Lock is off), also saves and quits (and saves one keystroke over :x - because you have to hit Enter after :x, but not after Shift-ZZ :) It is also (slightly) faster to type, since the (left) Shift key is just next to the Z key (at least on some keyboards, like mine at present).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: