com.sec.android.ofvi,vi

VI(1)FreeBSDGeneralCommands Manual VI(1)

NAME

ex, vi, view -- text editors

SYNOPSIS

ex[-FRrSsv] [-c cmd] [-t tag] [-wsize] [file ...]

vi [-eFRrS] [-c cmd] [-t tag] [-wsize] [file ...]

view [-eFrS] [-c cmd] [-t tag] [-wsize] [file ...]

DESCRIPTION

viis a screen-oriented text editor. ex is a line-oriented text editor.

exand vi are different interfacesto the same program, and it is possi-

ble to switch backand forth during an edit session. viewis the equiva-

lent of using the -R (read-only) option ofvi.

This manual page is the one provided with the nex/nvi versions of the

ex/vi texteditors. nex/nvi are intended as bug-for-bug compatible re-

placementsfor theoriginal FourthBerkeley Software Distribution (4BSD)

exand vi programs. For the rest of this manual page, nex/nvi is used

only when it's necessary to distinguish itfrom the historic implementa-

tions of ex/vi.

This manual page is intended for users already familiar with ex/vi. Any-

one else should almost certainly read a good tutorial on the editor be-

fore this manual page. Ifyou're in an unfamiliarenvironment, and you

absolutelyhave toget work done immediately, readthe section after the

options description, entitled FASTSTARTUP. It's probablyenough to get

you going.

The following options are available:

-ccmd Execute cmd on the firstfile loaded. Particularly useful for

initial positioning in the file,although cmd isnot limited to

positioning commands. This is the POSIX1003.2 interface for

the historic "+cmd" syntax. nex/nvi supports both the old and

new syntax.

-e Start editing inex mode, as if the command namewere ex.

-F Don't copy the entire file when first starting to edit.(The

default is to make a copy in case someone else modifies the

file during youredit session.)

-R Start editing inread-only mode,as if the command name was

view, orthe readonly option wasset.

-r Recover the specified files, or,if no files arespecified,

list thefiles that could be recovered.If no recoverable

files bythe specified name exist, the file is edited asif the

-r option had not been specified.

-S Run withthe secure editoption set, disallowingall access to

externalprograms.

-s Enter batch mode; applicable only to ex edit sessions. Batch

mode is useful when running ex scripts.Prompts, informative

messagesand other user orientedmessages are turned off, and

no startup filesor environment variables are read. This is

the POSIX 1003.2interface for the historic "-" argument.

nex/nvi supportsboth the old and new syntax.

-ttag Start editing atthe specified tag (see ctags(1)).

-v Start editing invi mode, as if the command namewas vi.

-wsize Set the initial window size to the specified number of lines.

Command input for ex/vi isread from the standard input. In the vi in-

terface, it is an error ifstandard input is not aterminal. In the ex

interface,if standard input is not a terminal, exwill read commands

from it regardless; however, the session will be abatch mode session,

exactly asif the -s option had been specified.

FAST STARTUP

This section will tell youthe minimum amount thatyou need to do simple

editing tasks using vi. If you'venever used any screen editor before,

you're likely to have problems even with this simple introduction. In

that case you should find someone that already knows vi and have them

walk you through this section.

viis a screen editor. This meansthat ittakes up almostthe entire

screen, displayingpart ofthe file on each screenline, except for the

last line of the screen. The lastline ofthe screen is used for you to

give commands to vi, and for vi togive information to you.

The other fact that you need to understandis thatvi is amodefuledi-

tor, i.e.,you areeither enteringtext oryou areexecuting commands,

and you have to bein the right mode to doone or the other. You will be

incommandmode when you first start editing a file. There are commands

that switch you into inputmode. There isonly one key that takesyou

out of input mode,and that is the key.

Inthis manual, key names are denoted with< and >, e.g., means

the "escape" key, usually labeled "Esc" onyour terminal'skeyboard. If

you're ever confused as towhich mode you're in, keep entering the

key untilvi beeps at you. Generally, viwill beep at you if

you try and do something that's not allowed. It will alsodisplayerror

messages.

Tostart editing afile, enter thefollowing command:

$ vifile

The command you should enter as soon as you start editing is:

:setverboseshowmode

This will make theeditor give youverboseerror messages and display the

current mode at the bottomof the screen.

The commands to move around the file are:

h Move the cursor left one character.

j Move the cursor down one line.

k Move the cursor upone line.

l Move the cursor right one character.

The cursorarrow keys should work,too.

/text Search forthe string "text" in the file, and movethe cursor to

its first character.

The commands to enter new text are:

a Append new text,after the cursor.

i Insert new text,before the cursor.

o Open a new line below the line the cursor is on,and start en-

tering text.

O Open a new line above the line the cursor is on,and start en-

tering text.

Once you've entered input mode using oneof the a, i, o or O

commands, use to quit entering text andreturn to com-

mand mode.

The commands to copy text are:

yy Copy the line the cursor is on.

p Append thecopied line after the line the cursor is on.

The commands to delete text are:

dd Delete theline the cursoris on.

x Delete thecharacter the cursor ison.

The commands to write the file are:

:w Write the file back to thefile with the name thatyou originally

used as anargument on thevi command line.

:wfile_name

Write the file back to thefile with the name file_name.

The commands to quit editing and exit the editor are:

:q Quit editing and leave vi (if you've modified the file, but not

saved yourchanges, vi will refuseto quit).

:q! Quit, discarding any modificationsthat you may have made.

One final caution:Unusualcharacters can take up more than one column on

the screen, and long linescan take up more than asingle screen line.

The above commandswork on"physical" characters and lines, i.e., they

affect theentire line no matter how many screen lines it takes upand

the entirecharacter no matter howmany screen columns it takes up.

REGULAREXPRESSIONS

ex/vi supports regular expressions(REs), as documented inre_format(7),

for line addresses, as thefirst part of the ex substitute, globaland v

commands, and in search patterns.Basic regular expressions (BREs) are

enabled bydefault; extended regular expressions (EREs) are used if the

extended option isenabled. The use of regular expressions can be

largely disabled using themagic option.

The following strings havespecialmeanings in theex/vi version of regu-

lar expressions:

+o An empty regular expression isequivalent to the last regular expres-

sion used.

+o `\

+o `\>' matches the end of the word.

+o `~' matches the replacement part of the last substitute command.

BUFFERS

A buffer is an area where commandscan save changed or deleted text for

later use. vi buffers arenamed with a single character preceded by a

double quote, for example "; exbuffersare thesame, but without the

double quote. nex/nvi permits theuse of any character without another

meaning inthe position where a buffer name is expected.

All buffers are either in line mode or character mode. Inserting a buf-

fer in line mode into the text creates newlines for each of the lines it

contains, while a buffer in character modecreatesnew lines for any

lines other than the firstand last lines it contains. The first and

last linesare inserted atthe current cursor position, becoming part of

the current line.If there is more than one line in the buffer, the cur-

rent line itself will be split. All ex commands which store text into

buffers doso in line mode. The behaviourof vi commands depend on their

associatedmotion command:

+o , h, l, ,, 0, B, E,F, T, W, ^, b, e, f andt make the

destination buffer character-oriented.

+o j, , k, ', -, G, H,L, M, _and | make the destination

bufferline-oriented.

+o $, %, `, (, ),/, ?, [[, ]], {and } make the destination buffer

character-oriented, unless thestarting and end positions are the

first and lastcharacters on aline. In that case, the bufferis

line-oriented.

The ex command display buffers displays the current mode for each buffer.

Buffers named `a' through `z' may be referred to using their uppercase

equivalent, in which case new content willbe appended to the buffer, in-

stead of replacingit.

Buffers named `1' through `9' are special. A region of text modified us-

ing the c (change)or d (delete) commands is placed into the numeric buf-

fer `1' ifno other bufferis specified and if it meets one of thefol-

lowing conditions:

+o It includes charactersfrom more than one line.

+o It is specified using a line-oriented motion.

+o It is specified using one of the following motion commands:

, `, n, N, %, /,{, }, (, ), and?.

Before this copy is done, the previous contents ofbuffer `1' are moved

into buffer `2', `2' into buffer `3', and so on. The contents of buffer

`9' are discarded. Note that thisrotation occursregardless of the user

specifyinganotherbuffer. In vi,text may be explicitly stored into the

numeric buffers. In this case, the bufferrotation occursbefore the re-

placement of the buffer's contents. The numeric buffers are only avail-

able in vimode.

VI COMMANDS

The following section describes the commands available in the command

mode of the vi editor. The following words have aspecialmeaningin the

commands description:

bigword Aset of non-whitespace characters.

buffer Temporaryarea where commands mayplace text. Ifnot specified,

the default buffer is used. See also BUFFERS, above.

count Apositive numberused tospecifythe desired number of itera-

tions of a command. It defaults to 1 if not specified.

motion Acursor movementcommandwhich indicatesthe other end of the

affected region of text, the first being the current cursor po-

sition. Repeating the command character makes itaffect the

whole current line.

word Asequence of letters, digits or underscores.

buffer andcount, if both present,may be specified in anyorder.motion

and count,if bothpresent, are effectively multiplied together and con-

sidered part of the motion.

Search forward forthe word starting at the cursorposition.

[count]

Page backwards count screens. Twolines of overlap are main-

tained, ifpossible.

[count]

Scroll forward count lines. If count is not given, scrollfor-

ward the number oflines specifiedby the last or

command. If this is the first command,

scroll half the number of lines inthe current screen.

[count]

Scroll forward count lines, leaving the current line and column

asis, if possible.

[count]

Page forward countscreens. Two lines of overlap are maintained,

ifpossible.

Display the following fileinformation: the file name (as given

tovi); whether the file has been modifiedsince it was last

written; if the file is read-only;the current line number; the

total number of lines in the file;and thecurrentline number as

a percentage of the total lines inthe file.

[count]

[count] h

Move the cursor back countcharacters in the current line.

[count]

[count]

[count] j

Move the cursor down countlines without changing the current

column.

Repaint the screen.

[count]

[count] +

Move the cursor down countlines to the first non-blank character

ofthat line.

[count]

[count] k

Move the cursor upcount lines, without changing the current col-

umn.

Return to the mostrecent tag context.

[count]

Scroll backwards count lines. If count isnot given, scroll

backwards the number of lines specified bythe last

or command. If this is the first com-

mand, scroll half the number of lines in the current screen.

Switch to the nextlower screen inthe window, or to the first

screen if there are no lower screens in the window.

[count]

Scroll backwards count lines, leaving the current line andcolumn

asis, if possible.

Suspend the current editorsession.

Execute the ex command being entered, or cancel itif it is only

partial.

Push a tagreference onto the tag stack.

Switch to the mostrecently editedfile.

[count]

[count] l

Move the cursor forward count characters without changing the

current line.

[count] ! motion shell-argument(s)

Replace the lines spanned by countand motion withthe output

(standard output and standard error) of the program named by the

shell option, called with a -c flag followed by the

shell-argument(s) (bundledinto a single argument). Within

shell-argument(s),the `%', `#' and `!' charactersare expanded

tothe current file name, the previous current file name, and the

command text of the previous ! or :! commands, respectively. The

special meaning of`%', `#' and `!' can beoverridden by escaping

them with a backslash.

[count] # #|+|-

Increment (trailing `#' or`+') ordecrement (trailing `-') the

number under the cursor bycount, startingat the cursor position

orat the first non-blank character following it.Numberswith a

leading `0x' or `0X' are interpreted as hexadecimal numbers.

Numbers with a leading `0'are interpretedas octal numbers un-

less they contain a non-octal digit. Other numbers may bepre-

fixed witha `+' or `-' sign.

[count] $

Move the cursor tothe endof a line. If count isspecified, ad-

ditionallymove the cursordown count - 1 lines.

% Move to the matchchars character matching the one found atthe

cursor position orthe closest to the right of it.

& Repeat theprevious substitution command on the current line.

'

`

Return to the cursor position marked by the character character,

or, if character is `'' or``', tothe position ofthe cursor be-

fore the last of the following commands: ,

, , %, ', `,(, ), /, ?, G, H, L, [[, ]],

{,}. Thefirst form returns to the firstnon-blank character of

the line marked bycharacter. Thesecond form returns to the

line and column marked by character.

[count] (

[count] )

Move countsentences backward or forward, respectively. Asen-

tence is an area of text that begins with the first nonblank

character following the previous sentence,paragraph, or section

boundary and continues until the next period, exclamation point,

orquestion mark character, followed by any numberof closing

parentheses, brackets, double or single quote characters, fol-

lowed by either anend-of-line or two whitespace characters.

Groups of empty lines (or lines containingonly whitespace

characters) are treated asa single sentence.

[count] ,

Reverse find character (i.e., the last F, f, T or t command)

count times.

[count] -

Move to the first non-blank character of the previous line, count

times.

[count] .

Repeat thelast vicommandthat modified text. count replaces

both the count argument ofthe repeated command and that of the

associatedmotion. If the. command repeats the ucommand, the

change logis rolled forward or backward, depending on theaction

ofthe u command.

/RE

/RE/ [offset] [z]

?RE

?RE? [offset] [z]

N

n Search forward (`/') or backward (`?') fora regular expression.

n and N repeat thelast search in the sameor opposite direc-

tions, respectively. If RE is empty, the last search regular ex-

pression is used.If offset is specified,the cursor is placed

offset lines before or after the matched regular expression. If

either n or N commands areused asmotion components for the !

command, there will be no prompt for the text of the command and

the previous ! will be executed. Multiplesearch patternsmay be

grouped together by delimiting them with semicolons and zero or

more whitespace characters. Thesepatterns are evaluated from

left to right withthe final cursor position determined bythe

last search pattern. A z command may be appended to the closed

search expressionsto reposition the result line.

0 Move to the first character in thecurrentline.

: Execute anex command.

[count] ;

Repeat thelast character find (i.e., the last F, f, T or t com-

mand) count times.

[count] < motion

[count] > motion

Shift count lines left or right, respectively, by an amount of

shiftwidth.

@ buffer

Execute a named buffer as vi commands. The buffermay include ex

commands too, but they must be expressed as a : command. If

buffer is `@' or `*', thenthe last bufferexecuted shall be

used.

[count] A

Enter input mode, appending the text afterthe endof the line.

Ifa countargument is given, the characters inputare repeated

count - 1 times after input mode is exited.

[count] B

Move backwards count bigwords.

[buffer] C

Change text from the current position to the end-of-line.If

buffer is specified, "yank" the deleted text into buffer.

[buffer] D

Delete text from the current position to the end-of-line.If

buffer is specified, "yank" the deleted text into buffer.

[count] E

Move forward countend-of-bigwords.

[count] F

Search count timesbackward through the current line for

.

[count] G

Move to line count, or thelast line of the file if count is not

specified.

[count] H

Move to the screenline count - 1 lines below the top of the

screen.

[count] I

Enter input mode, inserting the text at the beginning of the

line. If a count argumentis given, the characters input are re-

peated count - 1 more times.

[count] J

Join countlines with the current line. The spacing between two

joined lines is set to twowhitespace characters if the former

ends with a question mark,a period or an exclamation point. It

isset to one whitespace characterotherwise.

[count] L

Move to the screenline count - 1 lines above the bottom of the

screen.

M Move to the screenline inthe middle of the screen.

[count] O

Enter input mode, appending text in a new line above the current

line. If a count argumentis given, the characters input are re-

peated count - 1 more times.

[buffer] P

Insert text from buffer before thecurrentcolumn if buffer is

character-orientedor before the current line if it is line-ori-

ented.

Q Exit vi (or visual) mode and switch to ex mode.

[count] R

Enter input mode, replacing the charactersin the current line.

Ifa countargument is given, the characters inputare repeated

count - 1 more times upon exit from insertmode.

[buffer] [count] S

Substitutecount lines. If bufferis specified, "yank" the

deleted text into buffer.

[count] T

Search backwards, count times, through thecurrentline for the

character after the specified .

U Restore the current line to its state before the cursor last

moved to it.

[count] W

Move forward countbigwords.

[buffer] [count] X

Delete count characters before thecursor,on the current line.

Ifbuffer is specified, "yank" thedeletedtext into buffer.

[buffer] [count] Y

Copy (or "yank") count lines into buffer.

ZZ Write the file andexit viif there are nomore files to edit.

Entering two "quit" commands in a row ignores any remaining file

toedit.

[count] [[

Back up count section boundaries.

[count] ]]

Move forward countsectionboundaries.

^ Move to the first non-blank character on the current line.

[count] _

Move down count - 1 lines,to the first non-blank character.

[count] a

Enter input mode, appending the text afterthe cursor. Ifa

count argument is given, the characters input are repeatedcount

number of times.

[count] b

Move backwards count words.

[buffer] [count] cmotion

Change theregion of text described by count and motion. If

buffer is specified, "yank" the changed text into buffer.

[buffer] [count] dmotion

Delete theregion of text described by count and motion. If

buffer is specified, "yank" the deleted text into buffer.

[count] e

Move forward countend-of-words.

[count] f

Search forward, count times, through the rest of the current line

for .

[count] i

Enter input mode, inserting the text before the cursor. If a

count argument is given, the characters input are repeatedcount

number of times.

m

Save the current context (line andcolumn)as .

[count] o

Enter input mode, appending text in a new line under the current

line. If a count argumentis given, the characters input are re-

peated count - 1 more times.

[buffer] p

Append text from buffer. Text is appendedafter the current col-

umn if buffer is characteroriented, or after the current line

otherwise.

[count] r

Replace count characters with character.

[buffer] [count] s

Substitutecount characters in thecurrentline starting with the

current character. If buffer is specified, "yank"the substi-

tuted textinto buffer.

[count] t

Search forward, count times, through the current line for the

character immediately before .

u Undo the last change made to the file. Ifrepeated, the ucom-

mand alternates between these two states.The . command, when

used immediately after u, causes the change log tobe rolled for-

ward or backward, depending on theaction of the ucommand.

[count] w

Move forward countwords.

[buffer] [count] x

Delete count characters atthe current cursor position, but no

more than there are till the end of the line.

[buffer] [count] ymotion

Copy (or "yank") atext region specified by count and motion into

a buffer.

[count1] z[count2] type

Redraw, optionallyrepositioning and resizing the screen.If

count2 is specified, limitthe screen sizeto count2 lines. The

following type characters may be used:

+ Ifcount1 is specified, place the line count1 at the top

ofthe screen. Otherwise,displaythe screen after the

current screen.

Place the line count1 at the top of the screen.

. Place the line count1 in the center of thescreen.

- Place the line count1 at the bottom of thescreen.

^ Ifcount1 is given, display the screen before the screen

before count1 (i.e., 2 screens before). Otherwise, dis-

play the screen before thecurrentscreen.

[count] {

Move backward count paragraphs.

[column] |

Move to a specificcolumn positionon the current line. If

column is omitted,move tothe start of the current line.

[count] }

Move forward countparagraphs.

[count] ~ motion

Ifthe tildeop option is not set, reverse the caseof the next

count character(s)and no motion can be specified. Otherwise

motion is mandatory and ~ reversesthe case of thecharacters in

a text region specified bythe count and motion.

Interrupt the current operation. The character is

usually .

VI TEXTINPUT COMMANDS

The following section describes the commands available in the textinput

mode of the vi editor.

Replay theprevious input.

Erase to the previous shiftwidth column boundary.

^

Erase all of the autoindent characters, and reset the autoindent

level.

0

Erase all of the autoindent characters.

Insert sufficient and characters to move forward to

the next shiftwidth columnboundary. If the expandtab option is

set, only insert characters.

Erase the last character.

Escape thenext character from anyspecialmeaning. The

character is usually .

Resolve all text input into the file, and return to command mode.

Erase the current line.

Erase the last word. The definition of word is dependent on the

altwerase and ttywerase options.

[0-9A-Fa-f]+

Insert a characterwith the specified hexadecimal value into the

text.

Interrupt text input mode,returning to command mode. The

character is usually .

EX COMMANDS

The following section describes the commands available in the ex editor.

Ineach entry below, the tag line is a usage synopsis for the command.

Scroll thescreen.

! argument(s)

[range] ! argument(s)

Execute a shell command, or filterlines through ashell command.

" A comment.

[range] nu[mber] [count] [flags]

[range] # [count] [flags]

Display the selected lines, each preceded with itsline number.

@ buffer

* buffer

Execute a buffer.

[range]

Shift lines left.

[line] = [flags]

Display the line number ofline. If line is not specified, dis-

play the line number of the last line in the file.

[range] >[> ...] [count] [flags]

Shift lines right.

ab[breviate] lhs rhs

vionly. Add lhs as an abbreviation for rhs to the abbreviation

list.

[line] a[ppend][!]

The input text is appendedafter the specified line.

ar[gs] Display the argument list.

bg vionly. Background the current screen.

[range] c[hange][!] [count]

The input text replaces the specified range.

chd[ir][!][directory]

cd[!] [directory]

Change thecurrentworkingdirectory.

[range] co[py] line [flags]

[range] t line [flags]

Copy the specifiedlines after thedestination line.

cs[cope] add | find | help| kill | reset

Execute a Cscope command.

[range] d[elete] [buffer] [count] [flags]

Delete thelines from the file.

di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]

Display buffers, Cscope connections, screens or tags.

[Ee][dit][!] [+cmd] [file]

[Ee]x[!] [+cmd] [file]

Edit a different file.

exu[sage] [command]

Display usage for an ex command.

f[ile] [file]

Display and optionally change the file name.

[Ff]g [name]

vimode only. Foreground the specified screen.

[range] g[lobal] /pattern/[commands]

[range] v /pattern/ [commands]

Apply commands to lines matching (`global') or notmatching (`v')

a pattern.

he[lp] Display a help message.

[line] i[nsert][!]

The input text is insertedbefore the specified line.

[range] j[oin][!] [count] [flags]

Join linesof texttogether.

[range] l[ist] [count] [flags]

Display the lines unambiguously.

map[!] [lhs rhs]

Define or display maps (for vi only).

[line] ma[rk]

[line] k

Mark the line withthe mark .

[range] m[ove] line

Move the specifiedlines after thetarget line.

mk[exrc][!] file

Write the abbreviations, editor options and maps to the specified

file.

[Nn][ext][!] [file...]

Edit the next filefrom the argument list.

pre[serve]

Save the file in aform that can later be recovered using the ex

-roption.

[Pp]rev[ious][!]

Edit the previous file from the argument list.

[range] p[rint] [count] [flags]

Display the specified lines.

[line] pu[t] [buffer]

Append buffer contents to the current line.

q[uit][!]

End the editing session.

[line] r[ead][!] [file]

Read a file.

rec[over] file

Recover file if itwas previously saved.

res[ize] [+|-]size

vimode only. Grow or shrink the current screen.

rew[ind][!]

Rewind theargument list.

se[t] [option[=[value]] ...] [nooption ...] [option? ...][all]

Display orset editor options.

sh[ell]

Run a shell program.

so[urce] file

Read and execute ex commands from a file.

[range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]

[range] & [options] [count] [flags]

[range] ~ [options] [count] [flags]

Make substitutions. The replace field maycontainany of the

following sequences:

`&' The text matched by pattern.

`~' The replacement part of the previous substitute command.

`%' Ifthis isthe entire replace pattern, thereplacement

part of the previous substitute command.

`\#' Where `#' is an integer from 1 to 9, the text matched by

the #'th subexpression in pattern.

`\L' Causes thecharacters up to the end of theline ofthe

next occurrence of`\E' or`\e' tobe converted tolower-

case.

`\l' Causes thenext character to be converted to lowercase.

`\U' Causes thecharacters up to the end of theline ofthe

next occurrence of`\E' or`\e' tobe converted toupper-

case.

`\u' Causes thenext character to be converted to uppercase.

su[spend][!]

st[op][!]

Suspend the edit session.The characteris usually

.

[Tt]a[g][!] tagstring

Edit the file containing the specified tag.

tagn[ext][!]

Edit the file containing the next context for the current tag.

tagp[op][!] [file | number]

Pop to thespecified tag in the tags stack.

tagpr[ev][!]

Edit the file containing the previous context for the current

tag.

tagt[op][!]

Pop to theleast recent tag on thetags stack, clearing the

stack.

una[bbreviate] lhs

vionly. Delete an abbreviation.

u[ndo] Undo the last change made to the file.

unm[ap][!]lhs

Unmap a mapped string.

ve[rsion]

Display the version of theex/vi editor.

[line] vi[sual] [type] [count] [flags]

exmode only. Enter vi.

[Vi]i[sual][!] [+cmd] [file]

vimode only. Edit a new file.

viu[sage] [command]

Display usage for a vi command.

[range] w[rite][!][>>] [file]

[range] w[rite] [!] [file]

[range] wn[!] [>>][file]

[range] wq[!] [>>][file]

Write the file.

[range] x[it][!] [file]

Exit the editor, writing the file if it has been modified.

[range] ya[nk] [buffer] [count]

Copy the specifiedlines to a buffer.

[line] z [type] [count] [flags]

Adjust thewindow.

SET OPTIONS

There are a large number of options that may be set (or unset) to change

the editor's behavior. This section describes theoptions, their abbre-

viations and theirdefaultvalues.

Ineach entry below, the first part of thetag line is thefull name of

the option, followed by any equivalent abbreviations. Thepart insquare

brackets is the default value of the option. Mostof the options are

boolean, i.e., they are either on or off, and do not have an associated

value.

Options apply to both ex and vi modes, unless otherwise specified.

altwerase [off]

vionly. Select an alternate worderase algorithm.

autoindent, ai [off]

Automatically indent new lines.

autoprint,ap [on]

exonly. Display the current lineautomatically.

autowrite,aw [off]

Write modified files automaticallywhen changing files or sus-

pending the editorsession.

backup [""]

Back up files before they are overwritten.

beautify, bf [off]

Discard control characters.

cdpath [environment variable CDPATH, or current directory]

The directory paths used as path prefixes for the cd command.

cedit [no default]

Set the character to edit the colon command-line history.

columns, co [80]

Set the number of columns in the screen.

comment [off]

vionly. Skip leading comments inshell, C and C++ language

files.

directory,dir [environment variable TMPDIR, or /tmp]

The directory where temporary files are created.

edcompatible, ed [off]

Remember the values of the`c' and`g' suffixes tothe substitute

commands, instead of initializing them as unset for each new com-

mand.

errorbells, eb [off]

exonly. Announceerror messages with a bell.

escapetime[1]

The tenthsof a second ex/vi waitsfor a subsequent key tocom-

plete an key mapping.

expandtab,et [off]

Expand characters towhen inserting,replacing or

shifting text, autoindenting, indenting with , out-

denting with , or when filtering lines with the! com-

mand.

exrc, ex [off]

Read the startup files in the local directory.

extended [off]

Use extended regular expressions (EREs) rather than basic regular

expressions (BREs). See re_format(7) for more informationon

regular expressions.

filec []

Set the character to perform file path completion on the colon

command line.

fileencoding, fe [auto detect]

Set the encoding of the current file.

flash [on]

Flash the screen instead of beeping the keyboard on error.

hardtabs, ht [0]

Set the spacing between hardware tab settings. This option cur-

rently hasno effect.

iclower [off]

Makes all regular expressions case-insensitive, aslong asan up-

per-case letter does not appear inthe search string.

ignorecase, ic [off]

Ignore case differences inregularexpressions.

inputencoding, ie [locale]

Set the encoding of your input characters.

keytime [6]

The tenthsof a second ex/vi waitsfor a subsequent key tocom-

plete a key mapping.

leftright [off]

vionly. Do left-right scrolling.

lines, li [24]

vionly. Set the number of lines in the screen.

lisp [off]

vionly. Modify various search commands and options to work with

Lisp. This optionis not yet implemented.

list [off]

Display lines in an unambiguous fashion.

lock [on]

Attempt toget an exclusive lock on any file beingedited,read

orwritten.

magic [on]

When turned off, all regular expression charactersexcept for `^'

and `$' are treated as ordinary characters. Preceding individual

charactersby `\' re-enables them.

matchchars[[]{}()]

Character pairs looked forby the % command.

matchtime [7]

vionly. The tenths of a second ex/vi pauses on the matching

character when theshowmatch option is set.

mesg [on]

Permit messages from otherusers.

msgcat [/usr/share/vi/catalog/]

Selects a message catalog to be used to display error and infor-

mational messages in a specified language.

modelines,modeline [off]

Read the first andlast few lines of each file forex commands.

This option will never be implemented.

noprint [""]

Charactersthat are never handled as printable characters.

number, nu[off]

Precede each line displayed with its current line number.

octal [off]

Display unknown charactersas octal numbers, instead of the de-

fault hexadecimal.

open [on]

exonly. If this option is not set, the open and visual commands

are disallowed.

optimize, opt [on]

vionly. Optimizetext throughputto dumbterminals. This op-

tion is not yet implemented.

paragraphs, para [IPLPPPQPP LIpplpipbp]

vionly. Define additional paragraph boundaries for the {and }

commands.

path [""]

Define additional directories to search for files being edited.

print [""]

Charactersthat are alwayshandledas printable characters.

prompt [on]

exonly. Display a command prompt.

readonly, ro [off]

Mark the file and session as read-only.

recdir [/var/tmp/vi.recover]

The directory where recovery filesare stored.

redraw, re[off]

vionly. Simulatean intelligent terminalon a dumb one.This

option is not yet implemented.

remap [on]

Remap keysuntil resolved.

report [5]

Set the number of lines about which the editor reports changes or

yanks.

ruler [off]

vionly. Display a row/column ruler on the colon command line.

scroll, scr [window size /2]

Set the number of lines scrolled.

searchincr[off]

Makes the / and ? commandsincremental.

sections, sect [NHSHH HUnhsh]

vionly. Define additional section boundaries forthe [[ and ]]

commands.

secure [off]

Turns off all access to external programs.

shell, sh [environment variable SHELL, or /bin/sh]

Select theshell used by the editor.

shellmeta [~{[*?$`'"\]

Set the meta characters checked todetermine if file name expan-

sion is necessary.

shiftwidth, sw [8]

Set the autoindentand shift command indentation width.

showmatch,sm [off]

vionly. Note theleft matching characters when the rightones

are inserted.

showmode, smd [off]

vionly. Display the current editor mode and a "modified"flag.

sidescroll[16]

vionly. Set the amount aleft-right scroll will shift.

slowopen, slow [off]

Delay display updating during textinput.This option is not yet

implemented.

sourceany [off]

Read startup filesnot owned by the current user.This option

will neverbe implemented.

tabstop, ts [8]

This option sets tab widths for the editordisplay.

taglength,tl [0]

Set the number of significant characters in tag names.

tags, tag [tags]

Set the list of tags files.

term, ttytype, tty[environment variable TERM]

Set the terminal type.

terse [off]

This option has historically made editor messages less verbose.

Ithas no effect in this implementation.

tildeop [off]

Modify the~ command to take an associatedmotion.

timeout, to [on]

Time out on keys which maybe mapped.

ttywerase [off]

vionly. Select an alternate erase algorithm.

verbose [off]

vionly. Display an errormessagefor every error.

w300 [no default]

vionly. Set the window size if the baud rate is less than 1200

baud.

w1200 [no default]

vionly. Set the window size if the baud rate is equal to1200

baud.

w9600 [no default]

vionly. Set the window size if the baud rate is greater than

1200 baud.

warn [on]

exonly. This option causes a warning message to be printed on

the terminal if the file has been modifiedsince it was last

written, before a ! command.

window, w,wi [environmentvariable LINES - 1]

Set the window size for the screen.

windowname[off]

Change theicon/window name to thecurrentfile name.

wraplen, wl [0]

vionly. Break lines automatically, the specifiednumber of col-

umns from the left-hand margin. If both the wraplen and

wrapmarginedit options are set, the wrapmargin value is used.

wrapmargin, wm [0]

vionly. Break lines automatically, the specifiednumber of col-

umns from the right-hand margin. If both the wraplen and

wrapmarginedit options are set, the wrapmargin value is used.

wrapscan, ws [on]

Set searches to wrap around the end or beginning of the file.

writeany, wa [off]

Turn off file-overwriting checks.

ENVIRONMENT

COLUMNS The number of columns on the screen. This value overrides any

system orterminal specific values. If the COLUMNS environment

variable is not set when ex/vi runs, or the columns option is

explicitly reset by the user, ex/vi enters the value intothe

environment.

EXINIT Alist ofex startup commands, read after/etc/vi.exrc unless

the variable NEXINIT is also set.

HOME The user's home directory, used as the initial directory path

for the startup $HOME/.nexrc and $HOME/.exrc files. Thisvalue

is also used as the default directory forthe cd command.

LINES The number of rows on thescreen. This value overrides any sys-

tem or terminal specific values.If the LINES environment vari-

able is not set when ex/vi runs, or the lines option is explic-

itly reset by theuser, ex/vi enters the value into the environ-

ment.

NEXINIT Alist ofex startup commands, read after/etc/vi.exrc.

SHELL The user's shell of choice (see also the shell option).

TERM The user's terminal type. The default isthe type "unknown".

If the TERM environment variable is not set when ex/vi runs, or

the term option is explicitly reset by the user, ex/vi enters

the valueinto the environment.

TMPDIR The location usedto store temporary files (see also the

directoryedit option).

ASYNCHRONOUS EVENTS

SIGALRM vi/ex uses this signal for periodic backups of file modifica-

tions and to display "busy" messages when operations arelikely

to take a long time.

SIGHUP

SIGTERM If the current buffer has changed since it was last written in

its entirety, the editorattempts to save the modified file so

it can be later recovered. See the vi/ex reference manual sec-

tion Recovery for more information.

SIGINT When an interrupt occurs, the current operation is halted and

the editor returns to the command level. If interruptedduring

text input, the text already input is resolved into the file as

if the text input had been normally terminated.

SIGWINCH The screen is resized. See the vi/ex reference manual section

Sizing the Screen for more information.

FILES

/bin/sh The default user shell.

/etc/vi.exrc System-wide vi startup file.It is read for ex com-

mandsfirst in the startup sequence.Must beowned

by root or the user, and writable only by theowner.

/tmp Temporary file directory.

/var/tmp/vi.recover The default recovery file directory.

$HOME/.nexrc Firstchoice for user's home directory startup file,

read for ex commands right after /etc/vi.exrcunless

either NEXINIT or EXINIT are set. Must be owned by

root or the user, andwritable only by the owner.

$HOME/.exrc Second choicefor user's homedirectory startup

file,read for ex commands under the same conditions

as $HOME/.nexrc.

.nexrc Firstchoice for local directory startup file, read

for ex commands at the end ofthe startup sequence

if the exrc option was turnedon earlier. Must be

ownedby the user andwritable only by the owner.

.exrc Second choicefor local directory startup file, read

for ex commands underthe same conditions as .nexrc.

EXIT STATUS

The ex andvi utilities exit 0 on success,and >0 if an error occurs.

SEE ALSO

ctags(1), iconv(1), re_format(7)

vi/ex reference manual,

https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf.

STANDARDS

nex/nvi isclose to IEEE Std 1003.1-2008 ("POSIX.1"). That document dif-

fers from historical ex/vipractice in several places; there are changes

tobe madeon bothsides.

HISTORY

The ex editor first appeared in 1BSD. Thenex/nvireplacements for the

ex/vi editor firstappeared in 4.4BSD.

AUTHORS

Bill Joy wrote theoriginal version of ex in 1977.

FreeBSD13.0 September25, 2020 FreeBSD 13.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值