Annotation of researchv10dc/man/adm/man1/vi.1, revision 1.1.1.1

1.1       root        1: .TH VI 1
                      2: .CT 1 editor
                      3: .SH NAME
                      4: ex, edit, vi \- text editor
                      5: .SH SYNOPSIS
                      6: .B ex
                      7: [
                      8: .I option ...
                      9: ]
                     10: .I file ...
                     11: .PP
                     12: .B edit
                     13: [
                     14: .I option ...
                     15: ]
                     16: .I file ...
                     17: .PP
                     18: .B vi
                     19: [
                     20: .I option ...
                     21: ]
                     22: .I file ...
                     23: .SH DESCRIPTION
                     24: .I Ex
                     25: is elaborated from
                     26: .IR ed (1).
                     27: .I Vi
                     28: is the display editing aspect of
                     29: .IR ex ;
                     30: .I edit
                     31: is a simplified subset of
                     32: .IR ex .
                     33: The editors work on several
                     34: .I files
                     35: simultaneously.
                     36: .I Vi
                     37: gets the terminal type from environment variable
                     38: .BR TERM .
                     39: .PP
                     40: The options are:
                     41: .TP
                     42: .BI -r " file
                     43: Recover the
                     44: .I file
                     45: after a crash in the editor.
                     46: If no file is specified, list all saved files.
                     47: .TP
                     48: .B -l
                     49: Lisp indent mode; give special meaning to editor commands
                     50: .BR ()[]{} .
                     51: .TP
                     52: .BI -w n
                     53: Default window size is
                     54: .I n
                     55: lines.
                     56: .TP
                     57: .B -x
                     58: Edit encrypted files; a key will be prompted for.
                     59: .TP
                     60: .B -R
                     61: Read only; no files will be changed.
                     62: .TP
                     63: .BI + cmd
                     64: Execute the specified
                     65: .I ex
                     66: command upon entering the editor.
                     67: .PP
                     68: The editors begin in `command mode'. 
                     69: An
                     70: .SM ESC
                     71: character typed in command mode cancels the command.
                     72: The commands
                     73: .B
                     74: a A c C i I o O R s S
                     75: enter input mode, where arbitrary text may be entered.
                     76: .SM ESC
                     77: or interrupt returns to command mode.
                     78: The commands
                     79: .B
                     80: : / ? !
                     81: take input from the last line of the screen, which is
                     82: ended by a newline, or canceled by an interrupt.
                     83: .PP
                     84: A number preceding commands 
                     85: .B z G |
                     86: specifies a line.
                     87: A number before almost any other command causes it
                     88: to be repeated.
                     89: .PP
                     90: In the following summary of
                     91: .I vi
                     92: commands
                     93: .B ^
                     94: means the `control' key.
                     95: Commands so marked work in input mode;
                     96: others work in command mode.
                     97: .PP
                     98: .de fq
                     99: \&\f5\\$1\fR   \\$2 \\$3 \\$4 \\$5 \\$6
                    100: ..
                    101: .de fz
                    102: \&\f5\\$1 \fI\\$2\fR   \\$3 \\$4 \\$5 \\$6
                    103: ..
                    104: .ta \w'\f5:e + file'u
                    105: File manipulation
                    106: .2C
                    107: .fq :w write back changes
                    108: .fz :w  file write \fIfile\fR
                    109: .fz :w!  file overwrite \fIfile\fR
                    110: .fq :q quit
                    111: .fq :q! quit, discarding changes
                    112: .fz :e file edit \fIfile\fR
                    113: .fq :e! reedit, discarding changes
                    114: .fq ":e\ +" file edit, starting at end
                    115: .fz ":e\ +"  starting at line \fIn\fP
                    116: .fq :sh run shell, then return
                    117: .fz :! cmd run shell command
                    118: .fq :n edit next \fIfile\fR argument
                    119: .fz : ex-cmd do editor command
                    120: .1C
                    121: .PP
                    122: Positioning in file
                    123: .2C
                    124: .fq ^F forward screen
                    125: .fq ^B backward screen
                    126: .fq ^D down half screen
                    127: .fq ^U up half screen
                    128: .fq G "to specified line (end default)
                    129: .fz / pat next line matching \fIpat\fR
                    130: .fz ? pat previous line matching
                    131: .fq n repeat last "\f5\e  or  ?\fP
                    132: .fz /\fIpat\fP/\o'+_' n "\fIn\fRth line after or before \fIpat\fR
                    133: .fq ( beginning of sentence
                    134: .fq ) end of sentence
                    135: .fq { beginning of paragraph
                    136: .fq } end of paragraph
                    137: .fq % find matching \f5(){}\fP
                    138: .1C
                    139: .PP
                    140: Adjusting the screen
                    141: .2C
                    142: .fq ^L clear and redraw
                    143: .fq ^R  "retype, eliminate \f5@\fR lines
                    144: .fq z redraw, current line at window top
                    145: .fq z- \&... at bottom
                    146: .fq z. \&... at center
                    147: .fq /\fIpat\fP/z- \fIpat\fR line at bottom
                    148: .fz z n use \fIn\fR-line window
                    149: .fq ^E scroll down one line
                    150: .fq ^Y scroll up one line
                    151: .1C
                    152: .PP
                    153: Marking and returning
                    154: .2C
                    155: .fq `` move cursor to previous context
                    156: .fq '' \&... at first nonwhite in line
                    157: .fz m x "mark position with letter \fIx\fR
                    158: .fz ` x move cursor to mark
                    159: .fz ' x \&... at first nonwhite
                    160: .1C
                    161: .PP
                    162: Line positioning
                    163: .2C
                    164: .fq H top line of screen
                    165: .fq L bottom line
                    166: .fq M middle line
                    167: .fq + next line, at first nonwhite
                    168: .fq - previous line, at first nonwhite
                    169: <newline>      same as \f5+\fR
                    170: .fq j next line, same column
                    171: .fq  k previous line, same column
                    172: .1C
                    173: .PP
                    174: Character positioning
                    175: .2C
                    176: .fq ^ first nonwhite (not CTRL)
                    177: .fq 0 beginning of line
                    178: .fq $ end of line
                    179: .fq l forward
                    180: .fq h backward
                    181: .fq ^L ^H same as \f5l h\fR
                    182: <space>        same as \f5l\fR
                    183: .fz f x find \fIx\fR forward
                    184: .fz F x find backward
                    185: .fz t x upto \fIx\fR forward
                    186: .fz T x back upto \fIx\fR
                    187: .fq ; repeat last \f5f F t T\fR
                    188: .fq , opposite of \f5;\fR
                    189: .fq | to specified column
                    190: .fq % find matching \f5(){}\fR
                    191: .1C
                    192: .PP
                    193: Words, sentences, paragraphs
                    194: .2C
                    195: .fq w word forward
                    196: .fq b word backward
                    197: .fq e end of word
                    198: .fq ) next sentence
                    199: .fq ( previous sentence
                    200: .fq } next paragraph
                    201: .fq { previous paragraph
                    202: .fq W blank-delimited word
                    203: .fq B backward to ...
                    204: .fq E to end of ...
                    205: .1C
                    206: .PP
                    207: Corrections
                    208: .2C
                    209: .fq ^H erase last character
                    210: .fq ^W erase last word
                    211: erase  your erase, same as \f5^H\fR
                    212: kill   your kill, erase this line
                    213: .fq \e quotes your erase or kill
                    214: ESC    return to command mode
                    215: .fq ^? interrupt, return to command mode
                    216: .fq ^D backtab over autoindent
                    217: .fq ^V quote nonprinting character
                    218: .1C
                    219: .PP
                    220: Insert and replace
                    221: .2C
                    222: .fq a append after cursor
                    223: .fq A append at end of line
                    224: .fq i insert before cursor
                    225: .fq I insert before first non-blank
                    226: .fq o open below line
                    227: .fq O open above
                    228: .fz r x replace one character
                    229: .fz R text replace characters
                    230: .1C
                    231: .PP
                    232: Operators
                    233: .PP
                    234: .br
                    235: Operators are followed by cursor motion and affect all
                    236: text that would have been moved over:
                    237: .B dw
                    238: deletes a word.
                    239: Double the operator, e.g.\&
                    240: .BR dd ,
                    241: to affect whole lines.
                    242: .2C
                    243: .fq d delete
                    244: .fq c change
                    245: .fq y yank lines to buffer
                    246: .fq < left shift
                    247: .fq > right shift
                    248: .fq ! filter through command
                    249: .fq = Lisp indent
                    250: .1C
                    251: .PP
                    252: Miscellaneous operators
                    253: .2C
                    254: .fq C change rest of line (\f5c$\fR)
                    255: .fq D delete rest of line (\f5d$\fR)
                    256: .fq s substitute characters (\f5cd\fR)
                    257: .fq S substitute lines (\f5cc\fR)
                    258: .fq J join lines
                    259: .fq x delete characters (\f5dl\fR)
                    260: .fq X ... before cursor (\f5dh\fR)
                    261: .fq Y yank lines (\f5yy\fR)
                    262: .1C
                    263: .PP
                    264: Yank and put
                    265: .2C
                    266: .fq p put buffer after cursor
                    267: .fq P put buffer before cursor
                    268: \f5"\fI x \f5p\fR      put from buffer \fIx\fR
                    269: .fz x y yank to buffer \fIx\fR
                    270: .fz x d delete to buffer \fIx\fR
                    271: .1C
                    272: .PP
                    273: Undo, redo, retrieve
                    274: .2C
                    275: .fq u undo last change
                    276: .fq U restore current line
                    277: .fq . repeat last change
                    278: \f5"\fI n \f5p\fR      retrieve \fIn\fR-th last delete
                    279: .1C
                    280: .PP
                    281: Special ex commands
                    282: .PP
                    283: .br
                    284: .I Ex
                    285: understands most
                    286: .I ed
                    287: commands, plus the commands indicated with
                    288: .B :
                    289: in the
                    290: .I vi
                    291: summary, plus the following, shown with their
                    292: shortest possible spellings:
                    293: .PD0
                    294: .2C
                    295: .BI ab brev
                    296: .BI ar gs
                    297: .BI co py
                    298: .BI map
                    299: .BI ma rk
                    300: .BI n ext
                    301: .BI nu mber
                    302: .BI pre serve
                    303: .BI pu t
                    304: .BI re ad
                    305: .BI rec over
                    306: .BI rew ind
                    307: .BI se t
                    308: .BI sh ell
                    309: .BI so urce
                    310: .BI st op
                    311: .BI una bbrev
                    312: .BI u ndo
                    313: .BI unm ap
                    314: .BI ve rsion
                    315: .BI vi sual
                    316: .BI x it
                    317: .BI ya nk
                    318: .BI z " window"
                    319: .BI < " lshift
                    320: .BI > " rshift
                    321: .BI ^D " scroll
                    322: .1C
                    323: The
                    324: .B set
                    325: command
                    326: controls various options;
                    327: .L set all
                    328: shows the list.
                    329: .SH EXAMPLES
                    330: .2C
                    331: .PD0
                    332: .TF /\fItext\fR<newline>
                    333: .TP
                    334: .B \(<-\(da\(ua\(->
                    335: arrow keys move the cursor
                    336: .TP
                    337: .B hjkl
                    338: same as arrow keys
                    339: .TP
                    340: .BI i text\fR<ESC>
                    341: .RI insert " text
                    342: .TP
                    343: .BI cw new\fR<ESC>
                    344: .RI "change word to " new
                    345: .TP
                    346: .B 3dw
                    347: delete 3 words
                    348: .TP
                    349: .B ZZ
                    350: exit, saving changes
                    351: .TP
                    352: .BI / text\fR<newline>
                    353: .RI "search for " text
                    354: .TP
                    355: .B ^U ^D
                    356: scroll up or down
                    357: .1C
                    358: .PD
                    359: .SH FILES
                    360: .TF /usr/lib/ex?.?preserve
                    361: .TP
                    362: .F /usr/lib/ex?.?recover
                    363: recover command
                    364: .TP
                    365: .F /usr/lib/ex?.?preserve
                    366: preserve command
                    367: .TP
                    368: .F /etc/termcap
                    369: describes capabilities of terminals
                    370: .TP
                    371: .F $HOME/.exrc
                    372: editor startup file
                    373: .TP
                    374: .F /tmp/Ex*
                    375: editor temporary
                    376: .TP
                    377: .F /tmp/Rx*
                    378: named buffer temporary
                    379: .TP
                    380: .F /usr/preserve
                    381: preservation directory
                    382: .SH SEE ALSO
                    383: .IR ed (1), 
                    384: .IR sam (9.1), 
                    385: .IR sed (1)
                    386: .br
                    387: W. Joy and M. Horton,
                    388: `An Introduction to Display Editing with Vi',
                    389: in
                    390: .I
                    391: Unix Programmer's Manual, Seventh Edition, Virtual VAX-11 Version,
                    392: 1980, Vol 2C
                    393: (Berkeley)
                    394: .ig
                    395: .SH BUGS
                    396: The
                    397: .I undo
                    398: command causes all marks to be lost on lines changed and then restored
                    399: if the marked lines were changed.
                    400: .br
                    401: .I Undo
                    402: never clears the buffer modified condition.
                    403: .br
                    404: The
                    405: .I z
                    406: command prints a number of logical rather than physical lines.
                    407: More than a screen full of output may result if long lines are present.
                    408: .br
                    409: File input/output errors don't print a name if the 
                    410: .LR -
                    411: option is used.
                    412: .br
                    413: There is no easy way to do a single scan ignoring case.
                    414: .br
                    415: The editor does not warn if text is placed in named buffers and not used
                    416: before exiting the editor.
                    417: .br
                    418: Null characters are discarded in input files, and cannot appear in resultant
                    419: files.
                    420: .br
                    421: Software tabs using
                    422: .B ^T
                    423: work only immediately after the
                    424: .LR autoindent .
                    425: .br
                    426: The
                    427: .L wrapmargin
                    428: option can be fooled since it looks at output columns when blanks are typed.
                    429: If a long word passes through the margin and onto the next line without a
                    430: break, then the line won't be broken.
                    431: .br
                    432: The
                    433: .I source
                    434: command does not work when executed as
                    435: .BR :source ;
                    436: there is no way to use the
                    437: .BR :append ,
                    438: .BR :change ,
                    439: and
                    440: .BR :insert
                    441: commands in
                    442: .I vi,
                    443: since it is not possible to give
                    444: more than one line of input to a
                    445: .B :
                    446: escape.
                    447: To use these
                    448: on a
                    449: .B :global
                    450: you must
                    451: .B Q
                    452: to
                    453: .I ex
                    454: command mode,
                    455: execute them, and then reenter the screen editor with
                    456: .L vi
                    457: or
                    458: .LR open .
                    459: ..

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.