Improvements for Editing

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

Command-Line History and Completion

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

This facility is controlled with the cedit option, whose value is a string.

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. On any given line when you hit ENTER, nvi executes that line. ESC is a good choice for this option. (Use ^V ^[ to enter it.)

Because the ENTER 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. (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.

Note

The nvi documentation indicates that TAB is another common choice for the filec option. To make this work, you must type :set filec=\TAB. In any case, in practice, using ESC for both options ...

Get Learning the vi and Vim Editors, 7th 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.