9.8 Improvements for EditingThis section describes the features of nvi that make simple text editing easier and more powerful. 9.8.1 Command-Line History and Completionnvi saves your ex command lines, and makes it possible to edit them for resubmission. This facility is controlled with the 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 Because the [RETURN]
key actually executes the
command, be careful to use either the In addition to being able to edit your command line, you can
also do filename expansion.
This feature is controlled with the 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
It is easiest to set these options in your .nexrc file: set cedit=^[ set filec=^[ 9.8.2 Tag StacksTag stacking is described in Section 8.5.3, "Tag Stacks" in Chapter 8 . nvi 's tag stack is the simplest of the four clones. Table 9.2 and Table 9.3 show the commands it uses.
You can set the
The nvi behaves like vi ; it uses the "word" under the cursor starting at the current cursor position. If your cursor is on the i in main , nvi will search for the identifier in , not main . nvi relies on the traditional tags file format. Unfortunately, this format is very limited. In particular, it has no concept of programming language scope , which allows the same identifier to be used in different contexts to mean different things. The problem is exacerbated by C++, which explicitly allows function name overloading , i.e., the use of the same name for different functions. nvi gets around the tags file limitations by using a different mechanism entirely: the cscope program. cscope is a proprietary but relatively inexpensive program available from the Bell Labs Software Toolchest. It reads C source files and builds a database describing the program. nvi provides commands that query the database and allow you to process the results. Because cscope is not universally available, we do not cover its use here. Details of the nvi commands are provided in the nvi documentation. The extended tags file format produced by Exuberant ctags does not produce any errors with nvi 1.79; however, nvi does not take advantage of this format either. 9.8.3 Infinite Undo
In vi
, the dot ( nvi
generalizes the dot command
into a full "redo" command, applying it even if the
last command was Thus, to begin a series of "undo" commands, first type a
Eventually, you will reach the initial state of your file. At
that point, typing nvi
does not allow you to provide a count to either
the 9.8.4 Arbitrary Length Lines and Binary Datanvi can edit files with arbitrary length lines and with an arbitrary number of lines. nvi
automatically handles binary data.
No special command-line options
or ex
options are required.
You use 9.8.5 Incremental Searching
As mentioned in
Section 8.6.4, "Incremental Searching"
in Chapter 8
,
you enable
incremental searching in nvi
using
The cursor moves through the file as you type, always being placed on the first character of the text that matches. 9.8.6 Left-Right Scrolling
As mentioned in
Section 8.6.5, "Left-Right Scrolling"
in Chapter 8
,
you enable
left-right scrolling in nvi
using
| ||||||||||||||||||
|