It is easy to insert text into an open file from another file. All that is necessary is to move the cursor to the location where you want the text inserted, then type
where "filename" is the name of the file to insert. For example, if you want to copy the contents of the file "peach" into the file "fruit," you would first position the cursor to the desired line in "fruit" and then type
Notice that this operation causes no change to the file "peach." You can also append text from the currently open file to any other file. This is accomplished using the :w (colon + "w") command followed without a space by >>. For example, to append the contents of a currently open file named "pear" to the file named "apple," type
At times it can be convenient to open multiple files simultaneously. This is efficiently accomplished by just listing all of the files to be opened after the vi command. For example, to simultaneously open files about three kinds of fruit, type:
This allows you to edit "apple" first. After saving "apple," typing If you want to simultaneously open all files in the current directory, just type
Next: Additional Operations
|