Reading and Writing Files

The vim editor reads a disk file into the Work buffer when you call vim from the shell. The ZZ command that terminates the editing session writes the contents of the Work buffer back to the disk file. This section discusses other ways of reading text into the Work buffer and writing it out.

Reading Files

The Read command reads a file into the Work buffer. The new file does not overwrite any text in the Work buffer but is positioned following the single address you specify (or the current line if you do not specify an address). You can use an address of 0 to read the file into the beginning of the Work buffer. The format of the Read command is

							:[address]r [filename]
						

As with other commands that begin with a colon, when ...

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.