[Novalug] :wq vs ZZ

James Ewing Cottrell III jecottrell3@comcast.net
Wed Dec 14 11:29:50 EST 2016


The real issue here is that after being logged on with multiple sessions 
on multiple hosts over several days, switching back and forth between 
tasks, it's not always easy to remember what you were editing and why, 
or even if it was modified. Indeed, one could argue that perhaps ":q" is 
the right thing, but often what is desired is "write if modified, else 
quit", exactly what ":x" or "ZZ" does.

However, even assuming that you Wanted to write, "ZZ", oer even ":x" is 
easier to type than ":wq". And yet, the latter persists in documentation.

JIM

On 12/14/2016 7:58 AM, William Sutton wrote:
>
> On Wed, 14 Dec 2016, James Ewing Cottrell III via Novalug wrote:
>
>>
>> Software Never Dies. Neither do Concepts. People STILL quote ":wq" as
>> the way to Exit VI, rather than ZZ (or :x) which will Avoid Writing
>> when need be.
>>
>
> I don't know why you would :wq if you just wanted to exit vi,
> particularly if you had, say, made a hash of things.
>
> You can also :q! to exit without writing.
>
> matter of fact, the ! makes it imperative, so if you have a file that
> doesn't want to let you write (as long as the filesystem is writable and
> it doesn't have chattr +i set), you can :w! to force a write.
>


More information about the Novalug mailing list