[comp.editors] autowrite

maart@cs.vu.nl (Maarten Litmaath) (10/10/89)

wsinkees@lso.win.tue.nl (Kees Huizing) writes:
\...
\How is this possible?  If you type ':q' nothing is written by our vi!
\I quit with '^Z' many times and sometimes I accidentally start up a new
\vi-job on the same file.  When I see the old jobs hanging around, I
\reactivate them and silently quit with ':q' without any harm.  
\Even if you have autowrite on, vi warns you when you quit this way and some
\changes have not been written yet.  
\So, what is going on here?  If there is something harmful in autowrite, I
\would really like to know, since I use it very heavily, quitting with '^Z'
\and executing latex etc. from within vi with ':!compile' .  Can someone
\explain me the danger of my ways?

This is the way to go!  Once you know how to use `autowrite', life with vi
becomes so much simpler...
From the Vi Reference:
...
    aw                      | autowrite - Write at every shell escape.
                            | (useful when compiling from within vi)
...
                            | `:map ^C :!cc %^V<cr>' to compile from within vi
-- 
The UNIX Way of doing something [...] is to make it look as much like a filter
as possible.  (Richard O'Keefe)        | Maarten Litmaath (mcsun!botter!maart)

erja@epimetheus.dk (Erik Jacobsen) (10/10/89)

In article <3627@solo5.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>This is the way to go!  Once you know how to use `autowrite', life with vi
>becomes so much simpler...
>From the Vi Reference:
>...
>    aw                      | autowrite - Write at every shell escape.
>                            | (useful when compiling from within vi)
>...
>                            | `:map ^C :!cc %^V<cr>' to compile from within vi

If you don't like autowrite you could do it:

         : map ^C :w!^V<cr>:!cc %^V<cr>


>-- 
>The UNIX Way of doing something [...] is to make it look as much like a filter
>as possible.  (Richard O'Keefe)        | Maarten Litmaath (mcsun!botter!maart)


--------------------------------------------------------------------
Erik Jacobsen,     Computer Science Department,    Aarhus University
Ny Munkegade,    Building 540,       DK-8000 Aarhus C,       Denmark

Phone: +45 86127188, Telefax: +45 86135725, Home phone: +45 86169199
         Internet: erja@daimi.dk,           Ham-radio: OZ6KS

ge@mcnc.org (George Entenman) (10/10/89)

In article <3436@daimi.dk> erja@daimi.DK (Erik Jacobsen) writes:
>In article <3627@solo5.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>>This is the way to go!  Once you know how to use `autowrite', life with vi
>>becomes so much simpler...
>>From the Vi Reference:
>>...
>>    aw                      | autowrite - Write at every shell escape.
>>                            | (useful when compiling from within vi)
>>...
>>                            | `:map ^C :!cc %^V<cr>' to compile from within vi
>
>If you don't like autowrite you could do it:
>
>         : map ^C :w!^V<cr>:!cc %^V<cr>
>

I do something very similar to avoid using autowrite.  At the top
of my C files, I have some lines that look like this (the ^M is entered
by typing '^V<CR>'):

/*
:w^M:!cc -o file file.c
 */

Then I simply yank that line into a buffer (usually "c) and execute it
whenever I need write and compile the file (@c).

I must admit, however, that in a windowing environment, I have gotten
used to writing the file and then moving to another window to compile
and execute the program.  So I don't escape from vi in any way.  (Who
knows why my officemate actually quits vi for each compilation????)

......................................................................

					George Entenman
					ge@mcnc.org