Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site munnari.OZ Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!munnari!kre From: kre@munnari.OZ (Robert Elz) Newsgroups: net.bugs Subject: Re: In vi, ZZ is not :wq Message-ID: <914@munnari.OZ> Date: Sat, 14-Sep-85 02:09:08 EDT Article-I.D.: munnari.914 Posted: Sat Sep 14 02:09:08 1985 Date-Received: Sun, 15-Sep-85 12:27:42 EDT References: <2073@ukma.UUCP> <153@chinet.UUCP>, <572@baylor.UUCP> <269@mot.UUCP> Organization: Comp Sci, Melbourne Uni, Australia Lines: 34 Summary: the behaviour of ZZ is not a bug! In article <269@mot.UUCP>, al@mot.UUCP (Al Filipski) writes: > ZZ is NOT equivalent to either :wq or :x on our System V.2 vi, > vi foo > > :w bar > ZZ > > does NOT cause the changes to be written to foo. > > ZZ apparently tries to be smart and avoid unnecessary writes, > but I would expect it to write the file being edited in the case > above. A bug, I'd call it. Wrong. ZZ writes the file in exactly the same cases as ":q" would say "file modified and not written" and not exit. Its a shorthand for people who get tired of that message, but don't want to get into the habbit of ":wq" (or ":x") every time they want to exit (which write the file every time, changed or not). The relevant point is that ZZ will not write the file if the changes exist somewhere - they may not be in the original file that you edited if you saved them elsewhere (but when I do this, I usually (99% of cases) DON'T want the changes written back to the original file) - but they do exist somewhere (maybe /dev/null if you did a ":w /dev/null" which is a useful technique at times). This discussion started when someone reported that after a "vi -r" an immediate ZZ would lose the file (not write it). That was a bug, and is fixed in 4.3 (simply a matter of the "changed" flag not being set after a "recover" operation), ":q" would have silently exited in the same circumstances. Robert Elz seismo!munnari!kre kre%munnari.oz@seismo.css.gov Brought to you by Super Global Mega Corp .com