9.8. Improvements for Editing

This section describes the features of nvi that make simple text editing easier and more powerful.

9.8.1. Command-Line History and Completion

nvi saves your ex command lines, and makes it possible to edit them for resubmission.

This facility is controlled with the cedit option.

When you type the first character of this string on the colon command line, nvi opens a new window on the command history that you can then edit. When you hit RETURN on any given line, nvi executes that line. ESC is a good choice for this option. (Use ^V ^[ to enter it.)

Because the RETURN key actually executes the command, be careful to use either the j or keys to move down from one line to the next.

In addition to being able to edit your command line, you can also do filename expansion. This feature is controlled with the filec option.

When you type the first character of this string on the colon command line, nvi treats the blank delimited word in front of the cursor as if it had an * appended to it and does shell-style filename expansion. ESC is also a good choice for this option.[4] (Use ^V ^[ to enter it.) When this character is the same as for the cedit option, the command-line editing is performed only when it is entered as the first character on the colon command line.

[4] Although the nvi documentation indicates that TAB is another common choice, we could ...

Get Learning the vi Editor, Sixth Edition 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.