Inserting and Saving Files

If you are editing a file and you realize that you want to pull in text from another file, you can use the :r command in vi command mode.

For example, if you want to read the contents of the file /tmp/myfile into the current document at the current cursor position, you enter command mode with the Escape key and type :r /tmp/myfile.

To save a file, you use the :w command. To save a file you just edited to /home/justin/ mynewfile, you enter :w /home/justin/mynewfile.

i- : i , Entering commands with the colon (:) specified first with the command will show

(■-<,- ^ i-.-.,".\'CV..\*:you what you are typing. If the colon is not used, as we have been doing, then you do not see the command you are using. The colon commands are usually used to manipulate text in a way that enables you to edit the command before you run it (by pressing Enter).

Was this article helpful?

0 0

Post a comment