vi(1) DG/UX 4.30 vi(1)
NAME
vi, vedit, view - screen-oriented (visual) display editor
based on ex
SYNOPSIS
vi [ -t tag ] [ -r file ] [ -L ] [ -l ] [ -wn ] [ -x ] [ -C
]
[ -R ] [ -c command ] name ...
view [ -t tag ] [ -r file ] [ -L ] [ -l ] [ -wn ] [ -x ] [
-C ]
[ -R ] [ -c command ] name ...
vedit [ -t tag ] [ -r file ] [ -L ] [ -l ] [ -wn ] [ -x ] [
-C ]
[ -R ] [ -c command ] name ...
DESCRIPTION
Vi (visual) is a display-oriented text editor based on an
underlying line editor ex(1). You can use the command mode
of ex from within vi, and vice-versa.
When using vi, changes you make to the file are reflected in
what you see on your terminal screen. The position of the
cursor on the screen indicates your position within the
file.
INVOCATION
Options are:
-t tag Edit the file containing the tag and position
the editor at its definition.
-r file Recover file after an editor or system crash.
-L List the names of all files saved as the
result of an editor or system crash.
-l LISP mode; indents appropriately for LISP
code. Also, the (),{},[[, and ]] commands
are modified to have meaning for LISP.
-wn Set the default window size to n. This is
useful when using the editor over a slow
speed communications line.
-x Encryption option (US distributions of the
software only); when used, vi simulates the X
command of ex(1) and prompts the user for a
key. This key is used to encrypt and decrypt
text using the algorithm of crypt(1). The X
Licensed material--property of copyright holder(s) Page 1
vi(1) DG/UX 4.30 vi(1)
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.
-C Encryption option; same as the -x option,
except that vi simulates the C command of
ex(1). The C command is like the X command
of ex(1), except that all text read in is
assumed to have been encrypted.
-R Readonly mode; the readonly flag is set,
preventing accidental overwriting of the
file.
-ccommand The specified ex command is interpreted
before editing begins.
The name argument indicates files to be edited.
The view invocation is the same as for vi, except that the
readonly flag is set.
The vedit invocation is intended for beginners. It is the
same as vi except the report flag is set to 1, the showmode
and novice flags are set, and magic is turned off. These
defaults make it easier to learn how to use the editor.
VI MODES
Command The normal and initial mode. Other modes
return to command mode upon completion. ESC
(escape) cancels a partial command.
Input Entered by a, i, A, I, o, O, c, C, s, and S.
Arbitrary text may then be entered. Input
mode is normally terminated with an ESC
character, or abnormally with an interrupt.
Last line Reading input for :, /, ?, or !; terminate
with a to execute, or an interrupt to
cancel.
COMMAND SUMMARY
Sample commands
<- ↓ ↑ -> Arrow keys move the cursor
h j k l Same as arrow keys
itext<ESC> Insert text abc
Licensed material--property of copyright holder(s) Page 2
vi(1) DG/UX 4.30 vi(1)
cwnew<ESC> Change word to new
eas<ESC> Pluralize word
x Delete a character
dw Delete a word
dd Delete a line
3dd Delete three lines
u Undo previous change
ZZ Exit vi, saving changes
:q! Quit, discarding changes
/text Search for text
^U ^D Scroll up or down
:ex cmd Perform an ex command
Counts before vi commands
Numbers may be typed as a prefix to some commands. They are
interpreted in one of these ways.
Line/column number z G |
Scroll amount ^D ^U
Repeat effect Most of the rest
Interrupting, canceling
<ESC> End insert or incomplete command
^? Your interrupt key interrupts
^L Reprint screen
^R Reprint screen if ^L is an arrow key
File manipulation
:w Write back changes
:q Quit
:q! Quit, discarding changes
:e name Edit file name
:e! Reedit, discarding changes
:e + name Edit file name, starting at end
:e +n Reedit starting at line n
:e # Edit alternate file
^^ Synonym for :e #
:w name Write file name
:w! name Overwrite file name
:sh Run shell, then return
:!cmd Run cmd, then return
:n Edit next file in arglist
:n args Specify new arglist
^G Show current file and line
:ta tagNL Position to tag tag
^] Position to tag specified by following word
In general, any ex command (such as substitute or global)
may be typed, preceded by a colon and followed by a .
Positioning within file
^F Forward screen
Licensed material--property of copyright holder(s) Page 3
vi(1) DG/UX 4.30 vi(1)
^B Backward screen
^D Scroll down half screen
^U Scroll up half screen
G Specified line (defaults to the last line)
/pat Next line matching pat
?pat Previous line matching pat
n Repeat last / or ?
N Reverse last / or ?
/pat/+n nth line after pat
?pat?-n nth line before pat
]] Next section/function
[[ Previous section/function
( Beginning of sentence
) End of sentence
{ Beginning of paragraph
} End of paragraph
% To matching
(,
),
{,
or
}.
Adjusting the screen
^L Clear and redraw
^R Retype, eliminating @ lines
z Position current line at window top
z- Position current line at window bottom
z. Position current line at window center
/pat/z- Position line matching pat at bottom
zn. Use n line window
^E Scroll window down 1 line
^Y Scroll window up 1 line
Marking and returning
`` Move cursor to previous position
'' Move cursor to previous line
mx Mark current position with letter x
`x Move cursor to position marked x
'x Move cursor to line marked x
Line positioning
H Top line on screen
L Last line on screen
M Middle line on screen
+ Next line, at first non-white character
- Previous line, at first non-white character
CR Same as +
Licensed material--property of copyright holder(s) Page 4
vi(1) DG/UX 4.30 vi(1)
↓ or j Next line, same column
↑ or k Previous line, same column
Character positioning
^ First non-white character
0 Beginning of line
$ End of line
l or -> Forward one column
h or <- Backwards one column
H Home of screen
space Same as ->
fx Find character x forward
Fx Find character x backward
tx Column before character x forward
Tx Column after character x backward
; Repeat last f, F, t, or T
, Reverse last f, F, t, or T
| To specified column number
% To matching (, {, ), or }
Words, sentences, paragraphs
w Word forward
b Word backward
e End of word
) Next sentence
} Next paragraph
( Back sentence
{ Back paragraph
W Blank delimited word forward
B Blank delimited word backward
E End of blank delimited word
Commands for LISP Mode
) Forward s-expression
} ... but do not stop at atoms
( Back s-expression
{ ... but do not stop at atoms
Corrections during insert
^H Erase last character
^W Erase last word
erase Your erase key, same as ^H
kill Your kill key, erase input this line
\ quotes ^H and your erase and kill keys
<ESC> Ends insertion, goes back to command mode
^? Your interrupt key, terminates insert mode
^D Backtab over autoindent
^^D Kill autoindent for this line
Licensed material--property of copyright holder(s) Page 5
vi(1) DG/UX 4.30 vi(1)
0^D Kill autoindent for succeeding lines
^V Quote non-printing character
Insert and replace
a Append after cursor
i Insert before cursor
A Append at end of line
I Insert before first non-blank character
o Open new line below
O Open new line above
rx Replace single character with x
Rtext<ESC> Replace multiple characters
Operators
Operators are followed by a cursor motion, and affect all
text that would have been moved over. For example, since w
moves over a word, dw deletes the word that would be moved
over. Double the operator to affect whole lines, e.g., type
dd.
d Delete
c Change
y Yank lines into buffer
< Left shift
> Right shift
! Filter through command
= Indent for LISP
Miscellaneous Operations
C Change rest of line (c$)
D Delete rest of line (d$)
s Substitute characters (cl)
S Substitute lines (cc)
J Join lines
x Delete characters (dl)
X Delete before cursor (dh)
Y Yank lines (yy)
Yank and Put
By default, a put operation inserts the text most recently
deleted or yanked. However, if a buffer is named, the text
in that buffer is put instead.
p Put text after cursor
P Put text before cursor
"xp Put text from buffer x
"xy Yank text into buffer x
"xd Delete text into buffer x
Undo, Redo, Retrieve
u Undo last change
Licensed material--property of copyright holder(s) Page 6
vi(1) DG/UX 4.30 vi(1)
U Restore current line
. Repeat last change
"dp Retrieve d'th last delete
SEE ALSO
ex(1), edit(1), ed(1).
WARNINGS AND BUGS
Software tabs using ^T work only immediately after an
autoindent.
Left and right shifts on intelligent terminals do not use
insert and delete character operations in the terminal.
If you use the C-shell and a Data General terminal in DG
mode, then the stop character (^Z) is also the cursor down
key. Typing the cursor down key will suspend vi instead of
moving the cursor down one line. To work around this
problem, reassign the stop character to another key, or set
the novice option.
Licensed material--property of copyright holder(s) Page 7