next up previous contents
Next: General Editing of Text Up: The Woodnotes Guide to Previous: Line Wrapping and Text   Contents

Files (Opening, Saving, etc.)

Use :e to begin editing a file and:w to write it to the disk. Watch out if you change the name of the file when saving: this is not "save as" but rather the command to save a file by the other name while you continue editing the first. That is to say, if you are editing file ``Introduction''" and issue a :w Temp a file called ``Temp'' will be saved to the disk which for an instant will be identical to ``Introduction.'' But as soon as you continue typing, your new edits will continue to be applied to the file ``Introduction.'' That makes this a good way to save temporary (working) files as you go. Use :saveas to save the working file under a new name and continue editing that new file.

One neat Vim trick of perhaps limited use to authors is the ability to specify a list of files to edit when you call the program. If, from the command line, you enter vim ch1 ch2 ch3 Vim will allow you to edit each of the three files in succession. In that case, :wn will write the file, close it,and then open the next (:wN opens the previous.). You can use :rw f to write the range r to file f (for example, :*w dialogue will take the entire visually selected range and write it out to a file called ``dialogue.'' Working in the other direction, :r dialogue will take the contents of the file ``dialogue'' and insert it at the cursor.

Finally, an easy way to go through the current file and select bits and pieces of it for use elsewhere is to write out, appending to the other file. For example, once you've selected something, ":w»goodies will append that selected text to the file ``goodies.'' You can then open up the file ``goodies'' to clean it up.

Figure 1: Files (Opening, Saving, etc.)
\begin{figure}\begin{tabular}{ll}
\par
Command & Key \ \hline
\par
Edit (Open)&...
... Save as & :saveas \\
Append to file & :w> > \\
\end{tabular}
\end{figure}


next up previous contents
Next: General Editing of Text Up: The Woodnotes Guide to Previous: Line Wrapping and Text   Contents
Randall Wood 2009-08-04