nvi—New vi

nvi is a vi clone created for the 4.4BSD Berkeley Unix release. It’s intended to be “bug-for-bug” compatible with the original, although it does have a number of extensions over the original vi.

Important Command-Line Options

-c command

Execute command at startup.

-F

Don’t copy the entire file when starting to edit.

-R

Start in read-only mode, setting the readonly option.

-s

Enter batch (script) mode. This is only for ex and is intended for running editing scripts. Prompts and nonerror messages are disabled.

-S

Run with the secure option set, disallowing access to external programs.

nvi Window Management Commands

Command

Function

bg

Hide the current window

di[splay] b[uffers]

Display all buffers, including named, unnamed, and numeric buffers

di[splay] s[creens]

Display the filenames of all backgrounded windows

Edit filename

Edit filename in a new window

Edit /tmp

Create a new window editing an empty buffer; /tmp is interpreted specially to create a new temporary file

fg filename

Uncover filename into the current window

Fg filename

Uncover filename in a new window; the current window is split

Next

Edit the next file in the argument list in a new window

Previous

Edit the previous file in the argument list in a new window

resize ±nrows

Increase or decrease the size of the current window by nrows rows

Tag tagstring

Edit the file containing tagstring in a new window

The ^W command cycles between windows, top to bottom. The :q and ZZ commands exit the current window.

You may have multiple windows open on the same file. Changes made in one window are reflected in the other.

nvi Extended Regular Expressions

You use :set extended to enable extended regular expression matching:

|

Indicates alternation. The left and right sides don’t need to be single characters.

+

Matches one or more of the preceding regular expressions. This is either a single character or a group of characters enclosed in parentheses.

?

Matches zero or one occurrence of the preceding regular expression.

(...)

Used for grouping, to allow the application of additional regular expression operators.

{...}

Describes an interval expression (interval expressions were defined in Vim Extended Regular Expressions).

When extended isn’t set, use { and }.

When extended is set, you should precede the above metacharacters with a backslash in order to match them literally.

Command-Line History and Completion Options

Option

Description

cedit

The first character of this string, when used on the colon command line, provides access to the command history; pressing ENTER on any given line executes that line.

filec

The first character of this string, when used on the colon command line, does shell-style filename expansion; when this character is the same as for the cedit option, command-line editing is performed only when the character is entered as the first character on the colon command line.

Both of these options are not set by default. Set them in your $HOME/.nexrc file.

Tag Stacks

nvi provides both ex and vi commands for managing the tag stack.

Tag commands—ex

Command

Function

di[splay] t[ags]

Display the tag stack

ta[g][!] tagstring

Edit the file containing tagstring as defined in the tags file

Ta[g][!] tagstring

Just like :tag, except that the file is edited in a new window

tagp[op][!] tagloc

Pop to the given tag or to the most recently used tag if no tagloc is supplied

tagt[op][!]

Pop to the oldest tag in the stack, clearing the stack in the process

Tag commands—vi

Command

Function

^]

Look up the location of the identifier under the cursor in the tags file and move to that location; the current location is automatically pushed to the tag stack

^T

Return to the previous location in the tag stack

nvi 1.79 set Options

Option

Default

backup

 

cdpath

Environment variable $CDPATH or current directory

cedit

 

comment

nocomment

directory (dir)

$TMPDIR, or /tmp

extended

noextended

filec

 

iclower

noiclower

leftright

noleftright

lock

lock

octal

nooctal

path

 

recdir

/var/tmp/vi.recover

ruler

noruler

searchincr

nosearchincr

secure

nosecure

shellmeta

~{[*?$`'"

showmode (smd)

noshowmode

sidescroll

16

taglength (tl)

0

tags (tag)

tags /var/db/libc.tags /sys/kern/tags

tildeop

notildeop

wraplen (wl)

0

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.109.141