Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ vi(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ed, red

ex



VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



-------------------------------------------------------------------------------
vi, vedit, view



PURPOSE

Edits files with a full screen display.

SYNTAX


+-------+   +------------+   +-----------------+   +----------------+
| vi    |---| +--------+ |---|      +--------+ |---| +---- + -----+ |--->
| view  |   +-| -l     |-+   +- -r -|        |-+   +-|            |-+
| vedit |    A| -t tag ||           +- file -+       +- + subcmd -+
+-------+    || -R     ||
             || -wnum  ||
             || -ynum  ||                            +------------+
             |+--------+|                        >---|            |---|
             +----------+                            +--- file ---+
                                                       A        |
                                                       +--------+
DESCRIPTION

The vi command is a display editor based on an underlying line editor (ex).
The view command is a read-only version of vi.  In it, the readonly option is
set to protect files during browsing.  The vedit command is a version of vi
intended for beginners.  In it, the report option is set to 1, and the showmode
and novice options are set.  Since novice is set, it is a line editor.  For
more information on these options, see "Setting Options."

The file parameter specifies the file or files to be edited.  If you supply
more than one file on the command line, vi edits each file in the order
specified.

When you use vi, changes you make to a file are reflected in your display.  The
position of the cursor on the display indicates its position within the file.
The subcommands effect the file at the cursor position.

The following list provides the maximum limits of the vi editor.  If you have
selected a language (through the LANG environment variable) that supports
multibyte characters, the character limits can be reduced by as much as 50%,
depending on the character code set being used.

  o 1024 characters per line
  o 256 characters per global command list
  o 128 characters in the previous inserted and deleted text
  o 100 characters in a shell escape command
  o 63 characters in a string-valued option
  o 30 characters in a tag name
  o 250,000 lines of 1024 characters per line silently enforced



Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             1





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



  o 128 map macros with 2048 characters total.  Each macro has a maximum of 100
    characters.
  o 100 characters per each map macro subcommand (or "rhs").

If vi is run in a non-interactive manner (that is, with standard input
redirected from a file), the command runs as though it were invoked as ex
rather than vi.

Editing States

The vi editor has the following operational states:

command state         This is the initial state.  Any subcommand can be entered
                      (except commands that can only be used in the input
                      state).  When subcommands and the other states end, they
                      return to this state.  Pressing the ESC key cancels a
                      partial command.

input state           Entered by the a, A, i, I, o, O, c, C, s, S, and R
                      subcommands.  After entering one of these commands, you
                      can enter text into the editing buffer at the current
                      cursor position.  To return to the command state, press
                      ESC for normal exit or press INTERRUPT (Ctrl-C) to end
                      abnormally.

last line state       Some subcommands (subcommands with the prefix :, /, ?,
                      !obj, or !!) read input on a line displayed at the bottom
                      of the screen.  When you enter the initial character, vi
                      places the cursor at the bottom of the screen, where you
                      enter the remaining characters of the command.  Press the
                      Enter key to perform the subcommand and INTERRUPT
                      (Ctrl-C) to cancel it.

Setting Options

The vi editor allows you to customize options so that you can use the editor
for a specific task.  Use the set command to set or change an option.  To view
the current setting of options, enter ":set all" while in vi command state.
Some options are set to a string or a number value.  Other options are simply
turned on or off.  To change an option that is set to a value, enter a command
in the form :set option=value.  To toggle an option that can be set to on or
off, enter a line of the form :set option to set it on or :set nooption to set
it off.

Options set by the set command last only for the current editing session.  To
have certain options set each time vi is started, use EXINIT variables or add
an .exrc file to your home directory.  All set command options and
abbreviations must be entered in ASCII characters.  See the Text Formatting
Guide for details.

Options can be abbreviated in a set command.  The following table lists some of
the most commonly-used options, abbreviations, and descriptions:



Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             2





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)




Figure 8 (Page 1 of 5). Commonly Used vi Options
Option      AbbreviationDescription

autoindent  ai          Indents automatically in text mode to the indentation
                        on the previous line by using the spacing between tab
                        stops specified by the shiftwidth option.  The default
                        is noai.  To back the cursor up to the previous tab
                        stop, type Ctrl-D.  This option is not in effect for
                        global commands.

autoprint   ap          Prints the current line after any command that changes
                        the editing buffer.  The default is ap.  This option
                        applies only to the last command in a sequence of
                        commands on a single line, and is not in effect for
                        global commands.

autowrite   aw          Writes the editing buffer to the file automatically
                        before the :n, :ta, Ctrl-^, and ! subcommands if the
                        editing buffer has been changed since the last write
                        command.  The default is noaw.

beautifying bf          Prevents user from entering control characters (except
text                    for tab, newline, and formfeed) in the editing buffer
                        during text entry.  The default is nobf.  This option
                        does not apply to command input.

directory   dir=        Displays the directory that contains the editing
                        buffer.  The default is dir=/tmp.

edcompatibleed          Retains global (g) and confirm (c) subcommand suffixes
                        during multiple substitutions and causes the read (r)
                        suffix to work like the r subcommand.  The default is
                        noed.

errorbells  eb          Error messages are preceded by a bell.  If possible, vi
                        places the error message in reverse video (white
                        lettering on a black background) instead of ringing a
                        bell.  The default is noeb.  This may not work on PS/2
                        machines.

flash       fl          Flashes error messages.  The default is flash.  If nofl
                        is set, it always beeps on errors, even if terminal can
                        flash.  This may not work on PS/2 machines.

hardtabs    ht=         Tells vi the distance between the hardware tab stops on
                        your display.  The default is ht=8.

ignorecase  ic          Ignores distinction between uppercase and lowercase
                        while searching for regular expressions.  The default
                        is noic.




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             3





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



Figure 8 (Page 2 of 5). Commonly Used vi Options
Option      AbbreviationDescription

lisp        lisp        Removes the special meaning of (), {}, [[ and ]] and
                        enables the = (formatted print) operator for
                        S-expressions, so you can edit LISP programs.  The
                        default is nolisp.

list        list        Displays text with tabs and the end of lines marked.
                        Tabs are displayed as "^I" and the end of lines as "$".
                        The default is nolist.

mesg        mesg        Causes write permission to be turned off to the
                        terminal while you are in visual mode, if nomesg is
                        set.  The default is mesg.

magic       magic       Treats the characters ., [, and "*" as special
                        characters in scans.  In off mode, only the "( )" and
                        "$" retain special meanings; however, special meaning
                        of other characters can still be evoked by preceding
                        the character with a "\".  The default is magic.

modeline    modeline    Runs editor command lines found in the first five and
                        the last five lines of the file.  An editor command
                        line may be anywhere in a line.  To be recognized as a
                        command line, it must contain a space or a tab followed
                        by the string "ex:" or "vi:".  The command line is
                        ended by a second ":".  The editor tries to interpret
                        any data between the first and second ":" as editor
                        commands.  The default is nomodeline.

novice      novice      A feature of viedit which makes it a line editor.  This
                        option cannot be set in vi The default is nonovice.

number      nu          Displays lines prefixed with their line numbers.  The
                        default is nonu.

optimize    opt         Speeds up the operation of terminals that lack
                        cursor-addressing.  The default is noopt.

paragraphs  para=       Defines to vi macro names that start paragraphs.  The
                        default is para=IPLPPPQPP LIpplpipnpbp.  Single letter
                        nroff macros, such as .P must include the space as a
                        quoted character if re-specifying a paragraph.

prompt      prompt      Command mode input is prompted with a colon (:).  The
                        default is prompt.

readonly    readonly    Sets permanent read mode.  The default is is
                        noreadonly.





Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             4





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



Figure 8 (Page 3 of 5). Commonly Used vi Options
Option      AbbreviationDescription

redraw      re          Simulates a smart work station on a dumb work station.
                        The default is nore.

remap       remap       If on, macros are repeatedly tried until they are
                        changed.  For example, if o is mapped to O and O is
                        mapped to I, and then remap is set, o maps to I.  But
                        if noremap is set, it maps to O.  The default is remap.

report      report=     Sets the number of repetitions of a command before a
                        message is displayed.  For subcommands that can produce
                        a number of messages, such as global subcommands, the
                        messages are displayed when the command is completed.
                        The default is report=5.

scroll      Pscroll=    Displays the default number of lines to be scrolled
                        when the user scrolls up or down.  The default is
                        scroll=12.  Changing this with the set option has no
                        effect.  This feature can be set by entering "n CTRL-d"
                        during the command mode.  "CTRL-u" and "CTRL-d" both
                        respond to this change.

sections    sect=       Defines to vi macro names that start sections.  The
                        default is sect=NHSHH HUuhsh+c.  Single letter nroff
                        macros, such as .P must include the space as a quoted
                        character if re-specifying a paragraph.

shell       sh=         Defines the shell for ! or :! commands.  The default is
                        sh=/bin/sh.

shiftwidth  sw=         Sets the distance for the software tab stops used by
                        autoindent, the shift commands ( > and < ), and the
                        input commands (Ctrl-D and Ctrl-T) to allow the editor
                        to indent text and move back to a previous indentation.
                        The default is sw=8.

showmode    smd         If smd is turned on, whenever you are in input mode, it
                        is indicated on the bottom line.  The default is
                        noshowmode.  (smd if you invoked vi as viedit.)

showmatch   sm          Shows the matching open parenthesis ( or open bracket {
                        as you type the close parenthesis ) or close bracket }.
                        The default is nosm.

slowopen    slow        Postpones updating the display during inserts.  The
                        default is slow.

tabstop     ts=         Sets distance between tab stops when a file is
                        displayed.  The default is ts=8.




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             5





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



Figure 8 (Page 4 of 5). Commonly Used vi Options
Option      AbbreviationDescription

taglength   tl          Tags are not significant beyond this many characters.
                        A value of zero (the default) means that all characters
                        are significant.

tags        tags        A list of files to be used as tag files for the tag
                        command.  The tag files are searched sequentially for
                        the requested tag.  The default is tags = tags
                        /usr/lib/tags.  Thus, by default, a file named tags in
                        the current directory, and a file named tags in
                        /usr/lib are searched.  /usr/lib/tags is a master file
                        for the entire system.

term        term=       Sets the kind of work station you are using.  The
                        default is term=$TERM where $TERM is the value of the
                        shell variable TERM.  You cannot set TERM directly
                        while you are in vi.  Set it at the shell level or quit
                        vi to ex command mode.  (:Q), type set term and
                        re-enter vi (:vi).

terse       terse       Allows vi to display the short form of messages.  The
                        default is noterse.

timeout     to          Sets a time limit of one second on entry of characters.
                        This limit allows the characters in a macro to be
                        entered and processed as separate characters when
                        timeout is set.  To resume use of the macro, set
                        notimeout.  The default is to (timeout).

warn        warn        Displays a warning message before the ! subcommand
                        executes a shell command if this is the first time you
                        have issued a shell command after a given set of
                        changes have been made in the editing buffer but not
                        written to a file.  The default is warn.

window      wi=         Sets the number of lines displayed in one window of
                        text.  The default is dependent on the baud rate at
                        which you are operating:  600 baud or less / 8 lines,
                        1200 baud / 16 lines, higher speeds / full screen minus
                        one.

wrapmargin  wm=         Sets the margin for automatic wordwrapping from one
                        line to the next.  The default is wm=0.  A value of
                        zero indicates no wordwrapping.

wrapscan    ws          Allows string searches to wrap from the end of the
                        editing buffer to the beginning.  The default is ws.






Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             6





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



Figure 8 (Page 5 of 5). Commonly Used vi Options
Option      AbbreviationDescription

writeany    wa          Turns off the checks usually made before a write
                        command.  The default is nowa.


VEDIT

vedit works much like vi but it is for beginning users.  When you enter the
input state (via the a, A, i, I, o, O, c, C, s, S, and R subcommands), the
bottom right hand portion of the screen verifies this.

The vedit command has the following main subcommands:  showmode, novice
andreport (the vedit default for report is 1).

Note:  When you are in vedit and enter :set, you see the options that are
       different from vi.

Defining Macros

If you use a subcommand or sequence of subcommands frequently, you can create a
macro that issues the subcommand or sequence when you call a macro.  To create
a macro, enter the sequence of subcommands into an editing buffer named with an
ASCII character.  When used, a - z overlay the contents of the buffer; A - Z
append text to the previous contents of the buffer, allowing the building of a
macro piece by piece.

To invoke the macro, enter "@"x where x is the letter name of the buffer.
Enter "@""@" to repeat the last macro you invoked.

Mapping Keys

You can use the map command to set a keystroke to a subcommand or a sequence of
subcommands.  To set a key mapping, enter

  :map key subcommand

where key (lhs) is the key to which you want to assign a subcommand or sequence
of subcommands and subcommand (rhs) is the subcommand or sequence of
subcommands.  (The key variable can contain Japanese characters.)  For example,
to set "@" to delete lines, enter:

  :map  @  dd

In this example, "@" is the key to which the subcommand is assigned and "dd" is
the subcommand.

In the next example, a subcommand sequence is mapped to a key:

  :map * {>>




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             7





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



The "*" is the key to which the subcommand sequence is assigned and "{>>" is
the subcommand sequence.  The "{" moves the cursor to the beginning of the
paragraph and the ">>" indents the paragraph to the next shiftwidth.

To display the list of the current key mappings (while you are in command
mode), enter the command :map.  You can also remove a key mapping.  To remove a
key mapping, enter :unmap string or :unmap! string, where string is the string
used after the :map command to set the key and subcommand sequence.  For
example to remove key mapping for the previous example:

  :unmap *

If function keys are defined for your terminal, they can be put in a map or
unmap command by typing Ctrl-V, then pressing the desired key.  Keys that are
infrequently used in editing are useful to define, such as a Shift, Ctrl, or
Alt function key with another key or one of the function keys F0 - F12.

Keeping a Customized Change

When you customize vi from the vi command line, the customized editor is in
effect until you exit the editor.  If you want to keep your assignments so you
can reuse them, you must put the commands in the file .exrc.  The editor reads
this file each time you call it.  When you type the commands in a file, do not
type the : (colon) before each command.  The : is only required if you are in
the editor.  Here is an example of an .exrc file:

  set ai aw
  set wm=5
  map  @  dd

FLAGS

-l                    Enters vi in LISP mode.  In this mode, vi indents
                      appropriately for LISP code and the (,), {, }, [[, and ]]
                      subcommands are modified to act appropriately for LISP.

-r file               Recovers file after an editor or system crash.  If you do
                      not specify a file name, vi displays a list of all saved
                      files.

-R                    Sets the readonly option to protect the file against
                      overwriting.

-t tag                Edits the file containing the tag and positions the
                      editor at its definition.

-wnum                 Sets the default window size to num.  This is useful when
                      you use the editor over a low speed line.

+subcmd               Performs the ex subcommand before editing begins.  If you
                      do not specify subcmd, the cursor is placed on the last
                      line of the file.



Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             8





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)




-ynum                 Allocates num number of lines at startup.

PARAMETERS

In the following lists, <ESC> stands for pressing the ESCAPE key instead of
pressing the Enter key.

General Subcommand Syntax

[named_buffer] [operator] [number] object

Surrounding square brackets indicate optional items:

[named_buffer]        A temporary text storage area in memory.

[operator]            Specifies the subcommand or action; tells vi what to do.

[number]              A whole decimal value that specifies either the extent of
                      the action, or a line address.

object                Specifies what to act on.  This can be a text object (a
                      character, word, sentence, paragraph, section, character
                      string) or a text position (a line, position in the
                      current line, screen position).

Counts before Subcommands

You may prefix many subcommands with a number.  vi interprets this number in
one of the following ways:

  1. Go to line number:

      5G
      10z

  2. Go to column number:

      25|

  3. Scroll number lines:

      10Ctrl-D
      10Ctrl-U

Subcommands for Moving within the File

There are many commands that you can use to move within a file.  They can be
entered while vi is in the command state.

MOVEMENTS WITHIN A LINE




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                             9





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



<- or h Moves the cursor one character to the left.
v or j  Moves the cursor down one line (but it remains in the same column).
^ or k  Moves the cursor up one line (but it remains in the same column).
-> or l Moves the cursor one character to the right.

CHARACTER POSITIONING WITHIN A LINE

^       Moves the cursor to the first nonblank character.

0       Moves the cursor to the beginning of the line.

$       Moves the cursor to the end of the line.

fx      Moves the cursor to the next x character.

Fx      Moves the cursor to the last x character.

tx      Moves the cursor to one column before the next x character.

Tx      Moves the cursor to one column after the last x character.

;       Repeat the last f, F, t, or T subcommand.

,       Repeat the last f, F, t, or T subcommand in the opposition direction.

num|    Moves the cursor to the specified column.

WORDS, SENTENCES, PARAGRAPHS

l       Moves the cursor to the next character (includes punctuation as words).

w       Moves the cursor to the next word (includes punctuation as words).

b       Moves the cursor to the previous word (includes punctuation as words).

e       Moves the cursor to the end of the word (includes punctuation as
        words).

W       Moves the cursor to the next word (ignores punctuation).

B       Moves the cursor to the previous word (ignores punctuation).

E       Moves the cursor to the end of the word (includes punctuation as part
        of the current word).

LINE POSITIONING

H       Moves the cursor to the top line on the screen.

L       Moves the cursor to the last line on the screen.





Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            10





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



M       Moves the cursor to the middle line on the screen.

+       Moves the cursor to the next line at its first nonblank character.

-       Moves the cursor to the previous line at its first nonblank character.

Enter   Moves the cursor to the next line at its first nonblank character.

SCROLLING

Ctrl-U  Scrolls up one half screen.
Ctrl-D  Scrolls down one half screen.
Ctrl-F  Scrolls forward one screen.
Ctrl-B  Scrolls backward one screen.

SEARCHING FOR PATTERNS

[num]G  Places the cursor at line number num or to the last line if num is not
        specified.

/pattern
        Places the cursor at the next line containing pattern.

?pattern
        Places the cursor at the next previous line containing pattern.

n       Repeats last search for pattern in the same direction.

N       Repeats last search for pattern in the opposite direction.

/pattern/+num
        Places the cursor at the numth line after the line matching pattern.

?pattern?-num
        Places the cursor at the numth line before the line matching pattern.

%       Finds the parentheses or brace that matches the one at the current
        cursor position.

The pattern can contain Japanese characters.

MOVING TO SENTENCES, PARAGRAPHS, OR SECTIONS

]]      Places the cursor at next section (or function if you are in the LISP
        mode).

[[      Places the cursor at previous section (or function if you are in the
        LISP mode).

(       Places the cursor at the beginning of the previous sentence (or the
        previous s-expression if you are in the LISP mode).




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            11





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



)       Places the cursor at the beginning of the next sentence (or the next
        s-expression if you are in the LISP mode).

{       Places the cursor at the beginning of the previous paragraph (or at the
        next list if you are in the LISP mode).

}       Places the cursor at the beginning of the next the paragraph, at the
        next list if you are in the LISP mode.

MARKING AND RETURNING

``      Moves the cursor to the previous location off current line.

''      Moves cursor to the beginning of the line containing the previous
        location off the current line.

mx      Marks the current position with letter x.

"x      Moves cursor to mark x.

'x      Moves cursor to the beginning of the line containing mark x.

The x variable must be an ASCII character.

ADJUSTING THE SCREEN

Ctrl-L       Clears and redraws the screen.

Ctrl-R       Redraws the screen and eliminates blank lines marked with a "@".

z            Redraws the screen with the current line at the top of the screen.

z-           Redraws the screen with the current line at the bottom of the
             screen.

z.           Redraws the screen with the current line at the center of the
             screen.

/pattern/z-  Redraws the screen with the line containing pattern at the bottom.
             The pattern can contain Japanese characters.

znum.        Makes the window num lines long.

Ctrl-E       Scrolls the window down 1 line.

Ctrl-Y       Scrolls the window up 1 line.

Subcommands for Editing

Use the following subcommands to edit your text.  Those subcommands that do not
have an "*" (asterisk) following them enter in the input state.  You return to




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            12





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



the command state by pressing the Esc key.  These subcommands affect the text
relative to the current cursor position.

EDITING THE FILE

atext   Inserts text after the cursor.

Atext   Adds text to the end of the line.

C       Changes rest of line (c$).

numcc   Changes lines.

numce   Changes text to the end of n words.

ch      Changes characters before cursor.

numcl   Changes characters (s).

numcw   Changes words from cursor position; can be used to change word endings,
        etc.

numcwtext
        Changes words to text.

<Enter> Split line at cursor position.

numdd "*"
        Deletes lines.

numde "*"
        Deletes text to the end of n words.

dh "*"  Deletes characters before the cursor (X).

numdl "*"
        Deletes characters.

numdw "*"
        Deletes words from cursor position; can be used to delete incorrect
        word endings.

itext   Inserts text before the cursor.  The text can contain Japanese
        characters.

Itext   Inserts text before the first nonblank character in the line.  The text
        can contain Japanese characters.

J  "*"  Joins lines.

o       Adds an empty line below the current line.




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            13





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



O       Adds an empty line above the current line.

numrx "*"
        Replaces the current character with x.  (Commands followed by "*" do
        not enter the input state.)

Rtext   Overwrites characters with text.

nums   "*"
        Substitutes characters (cl).

S   "*" Substitutes lines (cc).

u "*"   Undoes the previous change.

numx  "*"
        Deletes characters (dl).

X  "*"  Deletes characters before cursor (dh).

numyh "*"
        Yanks characters before cursor into the undo buffer.

numyl "*"
        Yanks characters (s) into the undo buffer.

numyw "*"
        Yanks words from cursor position into the undo buffer.

numyy "*"
        Yanks lines into the undo buffer.

<< "*"  Shifts one line to the left.

<L      Shifts all lines from the cursor to the end of the screen to the left.

>> "*"  Shifts one line to the right.

>L      Shifts all lines from the cursor to the end of the screen to the right.

~       Changes letters at cursor to opposite case.

! "*"   Indents for LISP.

CORRECTIONS DURING INSERT Use the following commands only while in the input
state; they have different meanings in the command state.

Ctrl-H  Erases last character.

Ctrl-W  Erases last word.





Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            14





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



\       Quotes the erase and kill characters.

<ESC>   Ends insertion, back to command state.

Ctrl-?  Interrupts, terminates insert or Ctrl-D.

Ctrl-D  Goes back to previous autoindent stop.

^Ctrl-D Ends autoindent for this line only.

0Ctrl-D Moves cursor back to left margin.

Ctrl-V  Enters nonprinting character.

MOVING TEXT

p       Puts back text in the undo buffer after the cursor.

P       Puts back text in the undo buffer before the cursor.

"xp     Puts back text from the buffer x.

"xd     Deletes text into the buffer x.

y       Places the object that follows (for example, w for word) in the undo
        buffer.

"xy     Places the object that follows in the x buffer.

Y       Places the line in the undo buffer.

The x variable must be an ASCII character.

RESTORING AND REPEATING CHANGES

u       Undoes the last change.

U       Restores the current line.

.       Repeats the last change.

"n p    Retrieves the nth last delete.

Interrupting, Cancelling, and Exiting vi

Q       Enter ex editor in command state.

ZZ      Exits vi, saving changes.

:q      Quits vi.  If you have changed the contents of the editing buffer, vi
        displays a warning message and does not quit.




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            15





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



:q!     Quits vi, discarding the editing buffer.

:sh     Runs a shell.  You can return to vi by pressing Ctrl-D.

:!cmd   Runs cmd, then returns.

:!!     Repeats the last :!cmd command.

n!!cmd  Executes shell command cmd and replaces the number of lines specified
        by n with the output of cmd.  If n is not specified, the default is 1.
        If cmd expects standard input, the lines specified are used as input.
        Thus the command "!sort" can sort a paragraph.

n!obj cmd
        Executes shell command cmd and replaces n with output of cmd.  If n is
        not specified, the default is 1.  If cmd expects standard input, the
        lines or obj specified is used as input.

<ESC>   Ends insert or ends an incomplete subcommand.

Ctrl-L  Redisplays a screen.

Ctrl-R  Redisplays the screen if Ctrl-L is the -> key.

Ctrl-?  Interrupts a subcommand.

File Manipulation

:e file Edits file.

:e!     Re-edits the current file and discards all changes.

:e  +file
        Edits file starting at the end.

:e  +num
        Edits file starting at line num.

:e #    Edits the alternate file.  The alternate file is usually the the
        previous current file name.  However if changes are pending on the
        current file when a new file is called, the new file becomes the
        alternate file.  This subcommand is the same as Ctrl ^.

:n      Edits next file in the list entered on the command line.

:n files
        Specifies new list of files to edit.  The file names can contain
        Japanese characters.

:r file Reads the file into the editing buffer by adding new lines below the
        current cursor position.




Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            16





VI, VEDIT, VIEW(1,C)        AIX Commands Reference         VI, VEDIT, VIEW(1,C)



:r !cmd Runs the shell command cmd and places its output in the file by adding
        new lines below the current cursor position.

:ta tag Edits a file containing tag at the location of tag.  The tag must
        contain ASCII characters.

:w      Writes the editing buffer contents to the original file.

:w file Writes the editing buffer contents to the named file.

:w! file
        Overwrites file with the editing buffer contents.

Ctrl-G  Shows current file name and line.

Ctrl ^  Edits the alternate file.  The alternate file is usually the the
        previous current file name.  However if changes are pending on the
        current file when a new file is called, the new file becomes the
        alternate file.  This subcommand is the same as :e #.

Ctrl ]  Finds the word at the cursor in the tags file and edits the indicated
        file, placing the cursor at the tag.  With noaw set, this only moves
        within the current file if changes have been made to the edit buffer.
        A warning message is posted if the desired tag is in another file.

RELATED INFORMATION

See the following commands:  ctags, "ed, red" and "ex."



























Processed November 8, 1990   VI, VEDIT, VIEW(1,C)                            17



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026