Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!vsi1!altnet!uunet!ocsmd!bell_hop!bell From: bell@bell_hop.uucp (John T. Bell) Newsgroups: comp.editors Subject: Re: Yet another vi question (summary) Summary: Your vi is broke. Keywords: vi, bugs, editors Message-ID: <166@ocsmd.OCS.COM> Date: 7 Oct 88 14:52:12 GMT Expires: 13 Oct 88 23:00:00 GMT References: <267@tijc02.UUCP> Sender: usenet@ocsmd.OCS.COM Reply-To: bell@bell_hop.UUCP (John T. Bell) Followup-To: John T. Bell Organization: Online Computer Systems, Inc. Lines: 20 Your vi seems to be broken. I have tried a number of the suggestions on various vi's all with success. (Including Xenix 2.2, and DOS). However I could not get vi to return to the top of the file, after including the template file. (ie; exec more than one ex command.) However a simple shell script may solve your problem. Something like this might work for you... # rem if file exists and contains data then just edit it. if test -s %1 vi %1 else # else give it the template and edit it. cat template >%1 vi %1 fi If you really wanted to be creative you could replace the reference to vi with a reference to the editor variable, and let the user use the editor of his/her choice. I am not aware of any problems with forking to a shell script so this may be your best solution.