vi(1)
_________________________________________________________________
vi, vedit, view Command
screen-oriented (visual) display editor based on ex
_________________________________________________________________
SYNTAX
vi [ -t tag ] [ -r file ] [ -l ] [ -wn ] [ -x ]
[ -R ] [ +command ] name ...
view [ -t tag ] [ -r file ] [ -l ] [ -wn ] [ -x ]
[ -R ] [ +command ] name ...
vedit [ -t tag ] [ -r file ] [ -l ] [ -wn ] [ -x ]
[ -R ] [ +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. If
file is not specified, a list of all saved files
is printed.
-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 mode; a key is prompted for, letting
you create or edit an encrypted file. This option
is NOT available in international distributions of
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
vi(1)
the DG/UX System.
-R Read-only mode; the readonly flag is set,
preventing accidental overwriting of the file.
+command 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. The report flag
is set to 1, and the showmode and novice flags are set. 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
<nl> 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
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!<nl> Quit, discarding changes
/text<nl> Search for text
^U ^D Scroll up or down
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
vi(1)
:ex cmd<nl> 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<nl> Write back changes
:q<nl> Quit
:q!<nl> Quit, discarding changes
:e name<nl> Edit file name
:e!<nl> Reedit, discarding changes
:e + name<nl> Edit file name, starting at end
:e +n<nl> Reedit starting at line n
:e #<nl> Edit alternate file
^^ Synonym for :e #
:w name<nl> Write file name
:w! name<nl> Overwrite file name
:sh<nl> Run shell, then return
:!cmd<nl> Run cmd, then return
:n<nl> Edit next file in arglist
:n args<nl> 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 <nl>.
Positioning within file
^F Forward screen
^B Backward screen
^D Scroll down half screen
^U Scroll up half screen
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)
vi(1)
G Specified line (defaults to the last line)
/pat<nl> 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<nl> Position current line at window top
z-<nl> Position current line at window bottom
z.<nl> Position current line at window center
/pat/z-<nl> Position line matching pat at bottom
zn.<nl> 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 +
DG/UX 4.00 Page 4
Licensed material--property of copyright holder(s)
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
DG/UX 4.00 Page 5
Licensed material--property of copyright holder(s)
vi(1)
\ 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
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
DG/UX 4.00 Page 6
Licensed material--property of copyright holder(s)
vi(1)
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
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.
DG/UX 4.00 Page 7
Licensed material--property of copyright holder(s)