Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > V

vi(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

vi, view, vedit — screen-oriented (visual) text editor

SYNOPSIS

vi [-] [-l] [-r] [-R] [-t tag] [-v] [-V] [-w size] [-x] [-C] [+ command] [file]...

UNIX Standard Synopsis

vi [-rR] [-c command] [-t tag] [-w size] [file]...

Obsolescent Options

vi [-rR] [+command] [-t tag] [-w size] [file]...

view [-] [-l] [-r] [-R] [-t tag] [-v] [-V] [-w size] [-x] [-C] [+ command] [file]...

vedit [-] [-r] [-R] [-l] [-t tag] [-v] [-V] [-w size] [-x] [-C] [+ command] [file]...

Remarks

The program names ex, edit, vi, view, and vedit are separate personalities of the same program. This manpage describes the behavior of the vi/view/vedit personality.

DESCRIPTION

The vi (visual) program is a display-oriented text editor that is based on the underlying ex line editor (see ex(1)). It is possible to switch back and forth between the two and to execute ex commands from within vi. The line-editor commands and the editor options are described in ex(1). Only the visual mode commands are described here.

The view program is identical to vi except that the readonly editor option is set (see ex(1)).

The vedit program is somewhat friendlier for beginners and casual users. The report editor option is set to 1, and the nomagic, novice, and showmode editor options are set.

In vi, the terminal screen acts as a window into a memory copy of the file being edited. Changes made to the file copy are reflected in the screen display. The position of the cursor on the screen indicates the position within the file copy.

The environment variable TERM must specify a terminal type that is defined in the terminfo database (see terminfo(4)). Otherwise, a message is displayed and the line-editor is invoked.

As with ex, editor initialization scripts can be placed in the environment variable EXINIT, or in the file .exrc in the current or home directory.

Options

vi recognizes the following command-line options:

-

Suppress all interactive-user feedback. This is useful when editor commands are taken from scripts.

-l

Set the lisp editor option (see ex(1)). Provides indents appropriate for lisp code. The (, ), {, }, [[, and ]] commands in vi are modified to function with lisp source code.

-r

Recover the specified files after an editor or system crash. If no file is specified, a list of all saved files is printed. You must be the owner of the saved file in order to recover it (superuser cannot recover files owned by other users).

-R

Set the readonly editor option to prevent overwriting a file inadvertently (see ex(1)).

-t tag

Execute the tag tag command to load and position a predefined file. See the tag command and the tags editor option in ex(1).

-v

Invoke visual mode (vi). Useful with ex, it has no effect on vi.

-V

Set verbose mode. Editor commands are displayed as they are executed when input from a .exrc file or a source file (see the source command in ex(1)).

-wsize

Set the value of the window editor option to size. If size is omitted, it defaults to 3.

-x

Set encryption mode. You are prompted for a key to allow for the creation or editing of an encrypted file. This command makes an educated guess to determine whether text read in is encrypted or not. The temporary buffer file is encrypted also, using a transformed version of the key typed in for the -x option (see the crypt command in ex(1)).

-C

Encryption option. Same as the -x option, except that all text read in is assumed to have been encrypted.

-c command

(Under UNIX Standard only, see standards(5))

+command

(Obsolescent) Begin editing by executing the specified ex command-mode commands. As with the normal ex command-line entries, the command option-argument can consist of multiple ex commands separated by vertical-line commands (|). The use of commands that enter input mode in this manner produces undefined results.

file

Specify the file or files to be edited. If more than one file is specified, they are processed in the order given. If the -r option is also specified, the files are read from the recovery area.

(Under UNIX Standard only, see standards(5)) If both the -t tag and -c command (or the obsolescent +command) options are given, the -t tag will be processed first, that is, the file containing the tag is selected by -t and then the command is executed.

When invoked, vi is in command mode. input mode is initiated by several commands used to insert or change text.

In input mode, ESC (escape) is used to leave input mode; however, two consecutive ESC characters are required to leave input mode if the doubleescape editor option is set (see ex(1)).

In command mode, ESC is used to cancel a partial command; the terminal bell sounds if the editor is not in input mode and there is no partially entered command.

WARNING: ESC completes a "bottom line" command (see below).

The last (bottom) line of the screen is used to echo the input for search commands (/ and ?), ex commands (:), and system commands (!). It is also used to report errors or print other messages.

The receipt of SIGINT during text input or during the input of a command on the bottom line terminates the input (or cancels the command) and returns the editor to command mode. During command mode, SIGINT causes the bell to be sounded. In general the bell indicates an error (such as an unrecognized key).

Lines displayed on the screen containing only a ~ indicate that the last line above them is the last line of the file (the ~ lines are past the end of the file). Terminals with limited local intelligence might display lines on the screen marked with an @. These indicate space on the screen not corresponding to lines in the file. (These lines can be removed by entering a ^R, forcing the editor to retype the screen without these holes.)

If the system crashes or vi aborts due to an internal error or unexpected signal, vi attempts to preserve the buffer if any unwritten changes were made. Use the -r command line option to retrieve the saved changes.

The vi text editor supports the SIGWINCH signal, and redraws the screen in response to window-size changes.

Command Summary

Most commands accept a preceding number as an argument, either to give a size or position (for display or movement commands), or as a repeat count (for commands that change text). For simplicity, this optional argument is referred to as count when its effect is described.

The following operators can be followed by a movement command to specify an extent of text to be affected: c, d, y, <, >, !, and =. The region specified begins at the current cursor position and ends just prior to the cursor position indicated by the move. If the command operates on lines only, all the lines that fall partly or wholly within this region are affected. Otherwise the exact marked region is affected.

In the following description, control characters are indicated in the form ^X, which represents Ctrl-X. Whitespace is defined to be the characters space, tab, and alternative space. Alternative space is the first character of the ALT_PUNCT item described in langinfo(5) for the language specified by the LANG environment variable (see environ(5)).

Unless otherwise specified, the commands are interpreted in command mode and have no special effect in input mode.

^B

Scroll backward to display the previous window of text. A preceding count specifies the number of windows to go back. Two lines of overlap are kept if possible.

^D

Scroll forward a half-window of text. A preceding count gives the number of (logical) lines to scroll, and is remembered for future ^D and ^U commands.

^D

(input mode) Backs up over the indentation provided by autoindent or ^T to the next multiple of shiftwidth spaces. Whitespace inserted by ^T at other than the beginning of a line cannot be backed over using ^D. A preceding ^ removes all indentation for the current and subsequent input lines of the current input mode until new indentation is established by inserting leading whitespace, either by direct input or by using ^T.

^E

Scroll forward one line, leaving the cursor where it is if possible.

^F

Scroll forward to display the window of text following the current one. A preceding count specifies the number of windows to advance. Two lines of overlap are kept if possible.

(Under UNIX Standard only, see standards(5) The current line is displayed and the cursor is moved to the first nonblank character of the current line or the first character if the line is a blank line.

^G

Print the current file name and other information, including the number of lines and the current position (equivalent to the ex command f).

^H

Move one space to the left (stops at the left margin). A preceding count specifies the number of spaces to back up. (Same as h).

^H

(input mode) Move the cursor left to the previous input character without erasing it from the screen. The character is deleted from the saved text.

^J

Move the cursor down one line in the same column, if possible. A preceding count specifies the number of lines to move down. (Same as ^N and j).

^L

Clear and redraw the screen. Use when the screen is scrambled for any reason.

^M

Move to the first nonwhitespace character in the next line. A preceding count specifies the number of lines to advance.

^N

Same as ^J and j.

^P

Move the cursor up one line in the same column. A preceding count specifies the number of lines to move up (same as k).

^R

Redraw the current screen, eliminating the false lines marked with @ (which do not correspond to actual lines in the file).

^T

Pop the tag stack. See the pop command in ex(1).

^T

(input mode) Insert shiftwidth whitespace. If at the beginning of the line, this inserted space can only be backed over using ^D.

^U

Scroll up a half-window of text. A preceding count gives the number of (logical) lines to scroll, and is remembered for future ^D and ^U commands.

^V

In input mode, ^V quotes the next character to permit the insertion of special characters (including ESC) into the file.

^W

In input mode, ^W backs up one word; the deleted characters remain on the display.

^Y

Scroll backward one line, leaving the cursor where it is, if possible.

^[

Cancel a partially formed command; ^[ sounds the bell if there is no partially formed command.

In input mode, ^[ terminates input mode. However, two consecutive ESC characters are required to terminate input mode if the doubleescape editor option is set (see ex(1)).

When entering a command on the bottom line of the screen (ex command line or search pattern with \ or ?), terminate input and execute command.

On many terminals, ^[ can be entered by pressing the ESC or ESCAPE key.

^\

Exit vi and enter ex command mode. If in input mode, terminate the input first.

^]

Take the word at or after the cursor as a tag and execute the tagMbobC editor command (see ex(1)).

^^

Return to the previous file (equivalent to :ex #).

space

Move one space to the right (stops at the end of the line). A preceding count specifies the number of spaces to go forward (same as l).

erase

Erase, where erase is the user-designated erase character (see stty(1)). Same as ^H.

kill

Kill, where kill is the user-designated kill character (see stty(1)). In input mode, kill backs up to the beginning of the current input line without erasing the line from the screen display.

susp

Suspend the editor session and return to the calling shell, where susp is the user-designated process-control suspend character (see stty(1)). See ex(1) for more information on the suspend editor command.

!

An operator that passes specified lines from the buffer as standard input to the specified system command, and replaces those lines with the standard output from the command. The ! is followed by a movement command specifying the lines to be passed (lines from the current position to the end of the movement) and then the command (terminated as usual by a return). A preceding count is passed on to the movement command after !.

Doubling ! and preceding it by count causes that many lines, starting with the current line, to be passed.

"

Use to precede a named buffer specification. There are named buffers 1 through 9 in which the editor places deleted text. The named buffers a through z are available to the user for saving deleted or yanked text; see also y, below.

$

Move to the end of the current line. A preceding count specifies the number of lines to advance (for example, 2$ causes the cursor to advance to the end of the next line).

%

Move to the parenthesis or brace that matches the parenthesis or brace at the current cursor position.

&

Same as the ex command & (that is, & repeats the previous substitute command).

'

When followed by a ', vi returns to the previous context, placing the cursor at the beginning of the line. (The previous context is set whenever a nonrelative move is made.) When followed by a letter a-z, returns to the line marked with that letter (see the m command), at the first nonwhitespace character in the line.

When used with an operator such as d to specify an extent of text, the operation takes place over complete lines (see also `).

`

When followed by a `, vi returns to the previous context, placing the cursor at the character position marked (the previous context is set whenever a nonrelative move is made). When followed by a letter a z, returns to the line marked with that letter (see the m command), at the character position marked.

When used with an operator such as d to specify an extent of text, the operation takes place from the exact marked place to the current position within the line (see also ').

[[

Back up to the previous section boundary. A section is defined by the value of the sections option. Lines that start with a form feed (^L) or { also stop [[.

If the option lisp is set, the cursor stops at each ( at the beginning of a line.

]]

Move forward to a section boundary (see [[).

^

Move to the first nonwhitespace position on the current line.

(

Move backward to the beginning of a sentence. A sentence ends at a ., !, or ? followed by either the end of a line or by two spaces. Any number of closing ), ], ", and ' characters can appear between the ., !, or ? and the spaces or end of line. If a count is specified, the cursor moves back the specified number of sentences.

If the lisp option is set, the cursor moves to the beginning of a lisp s-expression. Sentences also begin at paragraph and section boundaries (see { and [[).

)

Move forward to the beginning of a sentence. If a count is specified, the cursor advances the specified number of sentences (see ().

{

Move back to the beginning of the preceding paragraph. A paragraph is defined by the value of the paragraphs option. A completely empty line and a section boundary (see [[ above) are also interpreted as the beginning of a paragraph. If a count is specified, the cursor moves backward the specified number of paragraphs.

}

Move forward to the beginning of the next paragraph. If a count is specified, the cursor advances the specified number of paragraphs (see {).

|

Requires a preceding count; the cursor moves to the specified column of the current line (if possible).

+

Move to the first nonwhitespace character in the next line. If a count is specified, the cursor advances the specified number of lines (same as ^M).

,

The comma (,) performs the reverse action of the last f, F, t, or T command issued, by searching in the opposite direction on the current line. If a count is specified, the cursor repeats the search the specified number of times.

-

The hyphen character (-) moves the cursor to the first nonwhitespace character in the previous line. If a count is specified, the cursor moves back the specified number of times.

_

The underscore character (_) moves the cursor to the first nonwhitespace character in the current line. If a count is specified, the cursor advances the specified number of lines, with the current line being counted as the first line; no count or a count of 1 specifies the current line.

.

Repeat the last command that changed the buffer. If a count is specified, the command is repeated the specified number of times.

/

Read a string from the last line on the screen, interpret it as a regular expression, and scan forward for the next occurrence of a matching string. The search begins when the user types a carriage return to terminate the pattern; the search can be terminated by sending SIGINT (or the user-designated interrupt character).

When used with an operator to specify an extent of text, the defined region begins with the current cursor position and ends at the beginning of the matched string. Entire lines can be specified by giving an offset from the matched line (by using a closing / followed by a +n or -n ).

0

Move to the first character on the current line (the 0 is not interpreted as a command when preceded by a nonzero digit).

:

The colon character (:) begins an ex command. The : and the entered command are echoed on the bottom line; the ex command is executed when the user types a carriage return.

;

Repeat the last single character find using f, F, t, or T. If a count is specified, the search is repeated the specified number of times.

<

An operator that shifts lines to the left by one shiftwidth. The < can be followed by a move to specify lines. A preceding count is passed through to the move command.

When repeated (<<), shifts the current line (or count lines starting at the current one).

>

An operator that shifts lines right one shiftwidth (see <).

=

If the lisp option is set, = reindents the specified lines, as if they were typed in with lisp and autoindent set. = can be preceded by a count to indicate how many lines to process, or followed by a move command for the same purpose.

?

Scan backwards, the reverse of / (see /).

@buffer

Execute the commands stored in the named buffer. Be careful not to include a <return> character at the end of the buffer contents unless the <return> is part of the command stream. Commands to be executed in ex mode should be preceded by a colon (:).

~

The tilde (~) switches the case of the character under the cursor (if it is a letter), then moves one character to the right, stopping at the end of the line). A preceding count specifies how many characters in the current line are switched.

A

Append at the end of line (same as $a).

B

Back up one word, where a word is any nonblank sequence, placing the cursor at the beginning of the word. If a count is specified, the cursor moves back the specified number of words.

C

Change the rest of the text on the current line (same as c$).

D

Delete the rest of the text on the current line (same as d$).

E

Move forward to the end of a word, where a word is any nonblank sequence. If a count is specified, the cursor advances the specified number of words.

F

Must be followed by a single character; scans backwards in the current line, searching for that character and moving the cursor to it, if found. If a count is specified, the search is repeated the specified number of times.

G

Go to the line number given as preceding argument, or the end of the file if no preceding count is given.

H

Move the cursor to the top line on the screen. If a count is given, the cursor moves to count number of lines from the top of the screen. The cursor is placed on the first nonwhitespace character on the line. If used as the target of an operator, entire lines are affected.

I

Insert at the beginning of a line (same as ^ followed by i).

J

Join the current line with the next one, supplying appropriate whitespace: one space between words, two spaces after a period, and no spaces at all if the first character of the next line is a closing parenthesis ()). A preceding count causes the specified number of lines to be joined, instead of just two.

L

Move the cursor to the first nonwhitespace character of the last line on the screen. If a count is given, the cursor moves to count number of lines from the bottom of the screen. When used with an operator, entire lines are affected.

M

Move the cursor to the middle line on the screen, at the first nonwhitespace position on the line.

N

Scan for the next match of the last pattern given to / or ?, but in the opposite direction; this is the reverse of n.

O

Open a new line above the current line and enter input mode.

P

Put back (replace) the last deleted or yanked text before/above the cursor. Entire lines of text are returned above the cursor if entire lines were deleted or yanked. Otherwise, the text is inserted just before the cursor.

(Under UNIX Standard only, see standards(5)) In this case, the cursor is moved to last column position of the inserted characters.

If P is preceded by a named buffer specification (x), the contents of that buffer are retrieved instead.

Q

Exit vi and enter ex command mode.

R

Replace characters on the screen with characters entered, until the input is terminated with ESC.

S

Change entire lines (same as cc). A preceding count changes the specified number of lines.

T

Must be followed by a single character; scan backwards in the current line for that character, and, if found, place the cursor just after that character. A count is equivalent to repeating the search the specified number of times.

U

Restore the current line to its state before the cursor was last moved to it.

(Under UNIX Standard only, see standards(5)) The cursor position is set to the column position 1 or to the position indicated by the previous line if the autoindent is set.

W

Move forward to the beginning of a word in the current line, where a word is a sequence of nonblank characters. If the current position is at the beginning of a word, the current position is within a bigword or the character at that position cannot be a part of a bigword, the current position shall move to the first character of the next bigword. If no subsequent bigword exists on the current line, the current position shall move to the first character of the first bigword on the first following line that contains the bigword. For this command, an empty or blank line is considered to contain exactly one bigword. The current line is set to the line containing the bigword selected and the current position is set to the first character of the bigword selected. A preceding count specifies the number of words to advance.

X

Delete the character before the cursor. A preceding count repeats the effect, but only characters on the current line are deleted.

Y

Place (yank) a copy of the current line into the unnamed buffer (same as yy). If a count is specified, count lines are copied to the buffer. If the Y is preceded by a buffer name, the lines are copied to the named buffer.

ZZ

Exit the editor, writing out the buffer if it was changed since the last write (same as the ex command x). Note that if the last write was to a different file and no changes have occurred since, the editor exits without writing out the buffer.

a

Enter input mode, appending the entered text after the current cursor position. A preceding count causes the inserted text to be replicated the specified number of times, but only if the inserted text is all on one line.

b

Back up to the previous beginning of a word in the current line. A word is a sequence of alphanumerics or a sequence of special characters. A preceding count repeats the effect.

c

Must be followed by a movement command. Delete the specified region of text, and enter input mode to replace deleted text with new text. If more than part of a single line is affected, the deleted text is saved in the numeric buffers. If only part of the current line is affected, the last character deleted is marked with a $. A preceding count passes that value through to the move command. If the command is cc, the entire current line is changed.

d

Must be followed by a movement command. Delete the specified region of text. If more than part of a line is affected, the text is saved in the numeric buffers. A preceding count passes that value through to the move command. If the command is dd, the entire current line is deleted.

e

Move forward to the end of the next word, defined as for b. A preceding count repeats the effect.

f

Must be followed by a single character; scan the rest of the current line for that character, and moves the cursor to it if found. A preceding count repeats the action that many times.

h

Move the cursor one character to the left (same as ^H). A preceding count repeats the effect.

i

Enter input mode, inserting the entered text before the cursor (see a).

j

Move the cursor one line down in the same column (same as ^J and ^N).

k

Move the cursor one line up (same as ^P).

l

Move the cursor one character to the right (same as <space>).

mx

Mark the current position of the cursor. x is a lowercase letter, a-z, that is used with the ` and ' commands to refer to the marked line or line position.

n

Repeat the last / or ? scanning commands.

o

Open a line below the current line and enter input mode; otherwise like O.

p

Put text after/below the cursor; otherwise like P.

r

Must be followed by a single character; the character under the cursor is replaced by the specified one. (The new character can be a new-line.) If r is preceded by a count, count characters are replaced by the specified character.

s

Delete the single character under the cursor and enter input mode; the entered text replaces the deleted character. A preceding count specifies how many characters on the current line are changed. The last character being changed is marked with a $, as for c.

t

Must be followed by a single character; scan the remainder of the line for that character. The cursor moves to the column prior to the character if the character is found. A preceding count is equivalent to repeating the search count times.

u

Reverse the last change made to the current buffer. If repeated, u alternates between these two states; thus is its own inverse. When used after an insertion of text on more than one line, the lines are saved in the numerically named buffers.

w

Move forward to the beginning of the next word (where word is defined as in b). A preceding count specifies how many words the cursor advances.

x

Delete the single character under the cursor. When x is preceded by a count, x deletes the specified number of characters forward from the cursor position, but only on the current line.

y

Must be followed by a movement command; the specified text is copied (yanked) into the unnamed temporary buffer. If preceded by a named buffer specification, "x, the text is placed in that buffer also. If the command is yy, the entire current line is yanked.

z

Redraw the screen with the current line placed as specified by the following options: z<return> specifies the top of the screen, z. the center of the screen, and z- the bottom of the screen. The commands z^ and z+ are similar to ^B and ^F, respectively. However, z^ and z+ do not attempt to maintain two lines of overlap. A count after the z and before the following character to specifies the number of lines displayed in the redrawn screen. A count before the z gives the number of the line to use as the reference line instead of the default current line.

Keyboard Editing Keys

At initialization, the editor automatically maps some terminal keyboard editing keys to equivalent visual mode commands. These mappings are only established for keys that are listed in the following table and defined in the terminfo(4) database as valid for the current terminal (as specified by the TERM environment variable).

Both command and input mode mappings are created (see the map command in ex(1)). With the exception of the insert char keys, which simply toggle input mode on and off, the input mode mappings exit input mode, perform the same action as the command mode mapping, and then reenter input mode.

On certain terminals, the character sequence sent by a keyboard editing key, which is then mapped to a visual mode command, can be the same character sequence a user might enter to perform another command or set of commands. This is most likely to happen with the input mode mappings; therefore, on these terminals, the input mode mappings are disabled by default. Users can override the disabling and enabling of both the command and input mode keyboard editing key mappings by setting the keyboardedit and keyboardedit! editor options as appropriate (see ex(1)). The timeout, timeoutlen, and doubleescape editor options are alternative methods of addressing this problem.

terminfocommandinputmap 
entrymode mapmode mapnamedescription
key_ici^[inscharinsert char
key_eici^[inscharend insert char
key_upk^[kauparrow up
key_downj^[jadownarrow down
key_lefth^[haleftarrow left
key_rightl^[larightarrow right
key_homeH^[Hahomearrow home
key_ilo^[^[o^[ainslineinsert line
key_dldd^[ddadellinedelete line
key_clear^L^[^Laclearclear screen
key_eold$^[d$aclreolclear line
key_sf^E^[^Eascrollfscroll down
key_dcx^[xadelchardelete char
key_npage^F^[^Fanpagenext page
key_ppage^B^[^Bappageprevious page
key_sr^Y^[^Yasrscroll up
key_eosdG^[dGaclreosclear to end of screen

EXTERNAL INFLUENCES

For information about the UNIX standard environment, see standards(5).

International codes and environment variables are explained in this section.

Environment Variables

COLUMNS overrides the system-selected horizontal screen size.

LINES overrides the system-selected vertical screen size, used as the number of lines in a screenful and the vertical screen size in visual mode.

SHELL is a variable that shall be interpreted as the preferred command-line interpreter for use in !, shell, read, and other commands with an operand of the form !string. For the shell command the program shall be invoked with the two arguments -c and string. If this variable is null or not set, the sh utility shall be used.

TERM is a variable that shall be interpreted as the name of the terminal type. If this variable is unset or null, an unspecified default terminal type shall be used.

PATH determines the search path for the shell command specified in the editor commands, shell, read, and write.

EXINIT determines a list of ex commands that will be executed on editor startup, before reading the first file. The list can contain multiple commands by separating them using a vertical line (|) character.

HOME determines a pathname of a directory that will be searched for an editor startup file named .exrc.

LC_ALL This variable shall determine the locale to be used to override any values for locale categories specified by the setting of LANG or any environment variables beginning with LC_.

LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.

LC_COLLATE determines the collating sequence used in evaluating regular expressions and in processing the tags file.

LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classification of characters as uppercase or lowercase letters, the shifting of letters between uppercase and lowercase, and the characters matched by character class expressions in regular expressions.

LANG determines the language in which messages are displayed.

LANGOPTS specifies options determining how text for right-to-left languages is stored in input and output files. See environ(5).

If LC_COLLATE or LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, the editor behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported.

WARNINGS

See also the WARNINGS section in ex(1).

Program Limits

vi places the following limits on files being edited.

Maximum Line Length

4096 characters including 2-3 bytes for overhead. Thus, a line length up to 4092 characters should cause no problem.

If you load a file that contain lines longer than the specified limit, the lines are truncated to the stated maximum length. Saving the file will write the truncated version over the original file, thus overwriting the original lines completely.

Attempting to create lines longer than the allowable maximum for the editor produces a line too long error message.

Maximum File Size

The maximum file length of 234,239 lines is silently enforced.

Other limits

  • 256 characters per global command list.

  • 128 characters in a file name in vi or ex open mode. On short-file-name HP-UX systems, the maximum file name length is 14 characters.

  • 128 characters in a previous insert/delete buffer.

  • 100 characters in a shell-escape command.

  • 63 characters in a string-valued option (:set command).

  • 30 characters in a program tag name.

  • 32 or fewer macros defined by map command.

  • 512 or fewer characters total in combined map macros.

Do not use the -C option to edit unencrypted files. The -C option is meant to be used only on files that are already encrypted. If the -C option is used on files which are not yet encrypted, a write in the edit session is likely to corrupt the file.

AUTHOR

vi was developed by the University of California, Berkeley. The 16-bit extensions to vi are based in part on software of the Toshiba Corporation.

SEE ALSO

ctags(1), ed(1), ex(1), stty(1), write(1), terminfo(4), environ(5), lang(5), regexp(5), standards(5).

The Ultimate Guide to the vi and ex Text Editors, Benjamin/Cummings Publishing Company, Inc., ISBN 0-8053-4460-8, HP part number 97005-90015.

STANDARDS CONFORMANCE

vi: SVID2, SVID3, XPG2, XPG3, XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.