Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!nucsrl!tellab5!vpnet!dattier From: dattier@vpnet.chi.il.us (David W. Tamkin) Newsgroups: comp.editors Subject: Re: :wq Message-ID: <1991Apr02.230226.7530@vpnet.chi.il.us> Date: 2 Apr 91 23:02:26 GMT References: <2900@wn1.sci.kun.nl> <1991Mar28.155305.8204@vpnet.chi.il.us> <1991Mar29.162034.12996@chinet.chi.il.us> Organization: VPNet Public Access Unix, Villa Park IL 60181-2206 Lines: 43 les@chinet.chi.il.us (Leslie Mikesell) wrote in <1991Mar29.162034.12996@chinet.chi.il.us>: | In article <1991Mar28.155305.8204@vpnet.chi.il.us> [I wrote]: | >If only vi didn't clear the [Modified] flag when you write to an | >outside file; that's the real problem. | | Actually there is an easy work-around for this. Just remember to do | a :w before you :w other_file. That keeps the file consistent | with the modified flag. That's the trick: remembering to :w first or, if you decide to make no more modifications, to make and undo a trivial one after :w and before :wq or ZZ or :x. I learned that the hard way, after getting burned several times by it, learning about it only when regular correspondents, who knew I wasn't a nutcase, told me that mail they received from me consisted of exactly the text they had sent me, set off by citation characters. I couldn't figure out what the heck was undoing my editing until I hit on this problem with vi. | [:x] | >| - it gives you a second chance if the write failed | >It does? I didn't know that. The only time a write ever failed on me the | >whole system locked up and I lost all my changes anyway, and I wasn't trying | >to quit vi, just to :w to save the changes so far. | It won't fix a system crash of course, but you can recover from things | like not having write permission or file system full errors if you | can save a copy somewhere else. :wq exits regardless. The :w attempt *caused* the system crash. The disks were full to bursting (I hadn't learned about df yet; if I'd known, I'd have been ready for the risk and :%p'ed to capture the text in my own computer before trying to :w) and the system was already gasping; my :w attempt was the coup de grace. [Note to the poster named, I think, Hoffmeyer who said that he prefers :wq to ZZ even though three keystrokes are more than two: :wq requires , so it's actually four keystrokes. I imagine that you still prefer it.] David Tamkin PO Box 7002 Des Plaines IL 60018-7002 dattier@vpnet.chi.il.us GEnie:D.W.TAMKIN CIS:73720,1570 MCIMail:426-1818 708 518 6769 312 693 0591