Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!pyrltd!tetrauk!rick From: rick@tetrauk.UUCP (Rick Jones) Newsgroups: comp.editors Subject: Re: edit multiple files in vi? Message-ID: <735@tetrauk.UUCP> Date: 20 Sep 90 13:24:46 GMT References: <1990Sep13.030424.27298@hybrid.UUCP> Reply-To: rick@tetrauk.UUCP (Rick Jones) Organization: Tetra Ltd., Maidenhead, UK Lines: 48 In article <1990Sep13.030424.27298@hybrid.UUCP> javey@hybrid.UUCP (Shahram Javey) writes: >Is there a way to edit multiple files in vi so that one could move >from one file to next and back again? Just to lob in a few other things: remember that :n file1 file 2 ... sets up a new list of files to edit - same as exiting and doing "vi file1 file2...", but without having to exit :rew goes back to the beginning of the file list :ar shows the list of file names, with the one you're on marked thus [..] If you have autowrite mode on (:set aw), then the current file will be written out automatically if you have changed it when you do any of :n, :rew, ctrl/^ (to switch files, :e# doesn't write out), or :! this saves all the :w's that you otherwise have to keep doing. Useful feature of ctrl/^ with aw mode is that if you do ":e newfile", and vi baulks because you haven't saved changes to the current file, a following ctrl/^ will save the current file, and switch to the newly named file. Anywhere on the command line, including shell escapes, % is the current filename, and # is the last (alternate) filename - hence :e# works. This is useful for quick test compiles, since ":!cc %" will C-compile the current file, writing it out if changed and aw mode is set. Also ! is the last shell command, so repeated compile tests reduce to ":!!". vi is like a Ferrari - it takes time to learn it properly but it's damn fast when you know what you're doing. Have fun -- Rick Jones The definition of atomic: Tetra Ltd. from the Greek meaning "indivisible" Maidenhead, Berks, UK So what is: rick@tetrauk.uucp an atomic explosion?