vi(1)vi(1)Namevi - screen editor
Syntaxvi [ -t tag ] [ +command ] [ -l ] [ -r ] [ -wn ] [ -x ] name...
Description
The (visual) editor is a display-oriented text editor based on The com‐
mand and the command run the same code. You can access the command
mode of from within
The following is a list of some of the commands. See the vi Beginner's
Reference Card and An Introduction to Display Editing with vi in the
Supplementary Documents, Volume 1: General User for more details on
using
Screen Control Commands
<CTRL/L> Reprints current screen.
<CTRL/Y> Exposes one more line at top of screen.
<CTRL/E> Exposes one more line at bottom of screen.
Paging Commands
<CTRL/F> Pages forward one screen.
<CTRL/B> Pages back one screen.
<CTRL/D> Pages down half screen.
<CTRL/U> Pages up half screen.
Cursor Positioning Commands
j Moves cursor down one line, same column.
k Moves cursor up one line, same column.
h Moves cursor back one character.
l Moves cursor forward one character.
<RETURN> Moves cursor to beginning of next line.
0 Moves cursor to beginning of current line.
$ Moves cursor to end of current line.
<SPACE> Moves cursor forward one character.
nG Moves cursor to beginning of line n. Default is last
line of file.
/pattern Moves cursor forward to next occurrence of pattern.
?pattern Moves cursor backward to next occurrence of pattern.
n Repeats last / or ? pattern search.
Text Insertion Commands
a Appends text after cursor. Terminated by <ESC>.
A Appends text at the end of the line. Terminated by
<ESC>.
i Inserts text before cursor. Terminated by <ESC>.
I Inserts text at the beginning of the line. Terminated
by <ESC>.
o Opens new line below the current line for text inser‐
tion. Terminated by <ESC>.
O Opens new line above the current line for text inser‐
tion. Terminated by <ESC>.
<DELETE> Overwrites last character during text insertion.
<ESC> Stops text insertion.
Text Deletion Commands
dw Deletes current word.
x Deletes current character.
dd Deletes current line.
D, d$ Deletes from cursor to end of line.
P Puts back text from the previous delete.
Text Change Commands
cw Changes characters of current word until stopped with
escape key.
c$ Changes text up to the end of the line.
C, c$ Changes remaining text on current line until stopped
by pressing the escape key.
~ Changes case of current character.
xp Transposes current and following characters.
J Joins current line with next line.
rx Replaces current character with x.
Buffer Usage Commands
[a-z]n yy Yanks n lines to the [a-z] buffer. Default is cur‐
rent line.
[a-z]n p Puts n yanked text lines from the a-z buffer, after
the cursor.
Exiting vi
ZZ Exits and saves changes
:wq Writes changes to current file and quits edit ses‐
sion.
:q Quits edit session (no changes made).
The command uses all of the same edit or commands as However, does not
allow you to write the file. See
Options-t tag Specifies a list of tag files. The tag files are preceded by
a backslash (\) and are separated by spaces. The tag option
should always be the first entry.
+command Tells the editor to begin by executing the specified command.
A useful example would be +/pattern to search for a pattern.
-l Sets the showmatch and lisp options for editing LISP code.
-r name Retrieves the last saved version of the name'd file in the
event of an editor or system crash. If no file is specified,
a list of saved files is produced.
-wn Sets the default window size to n. This option is useful for
starting in a small window on dialups. The -x option is
available only if the Encryption layered product is
installed.
-x Causes to prompt for a key. The key is used to encrypt and
decrypt the contents of the file. If the file contents have
been encrypted with one key, you must use the same key to
decrypt the file.
Restrictions
Software tabs using ^T work only immediately after the autoindent.
Left and right shifts on intelligent terminals do not make use of
insert and delete character operations in the terminal.
The wrapmargin option sometimes works incorrectly because it looks at
output columns when blanks are typed. If a long word passes through
the margin and onto the next line without a break, then the line is not
broken.
Insert/delete within a line can be slow if tabs are present on intelli‐
gent terminals, since the terminals need help in doing this correctly.
Saving text on deletes in the named buffers is somewhat inefficient.
The source command does not work when executed as :source; there is no
way to use the :append, :change, and :insert commands, since it is not
possible to give on a :global you must Q to command mode, execute them,
and then reenter the screen editor with or
The command dumps core when you edit a large file from an nfs-mounted
file system on a CRAY computer. The problem occurs only when the line
buffer size, is over the ULTRIX limit of 8 Kbytes.
The command uses a symbolic link to to preserve and recover an edited
file. It is required that the symbolic link is there to allow to work
properly.
The editor command is supposed to delete n lines, but it deletes n+1
lines. You can work around this problem by using the command
See Alsoed(1), ex(1), view(1)
The Little Gray Book: An ULTRIX Primer
The Big Gray Book: The Next Step with ULTRIX
An Introduction to Display Editing with vi, Supplementary Documents,
Volume 1: General User
vi(1)