From 6e83b80adb58faf10a5131e3aaba327a31c419ef Mon Sep 17 00:00:00 2001 From: skimo Date: Sat, 18 Aug 2001 20:43:47 +0000 Subject: [PATCH] replace roff reference by texinfo version --- docs/vi.ref/Makefile | 62 +- docs/vi.ref/{ex.cmd.roff => ex.cmd.texi} | 2075 ++++++++--------- docs/vi.ref/merge.awk | 16 - docs/vi.ref/ref.so | 103 - docs/vi.ref/ref.texi | 64 + docs/vi.ref/{set.opt.roff => set.opt.texi} | 1317 +++++------ docs/vi.ref/{vi.cmd.roff => vi.cmd.texi} | 3342 ++++++++++++++-------------- docs/vi.ref/{vi.ref => vi.texi} | 2145 +++++++++--------- 8 files changed, 4600 insertions(+), 4524 deletions(-) rewrite docs/vi.ref/Makefile (79%) rename docs/vi.ref/{ex.cmd.roff => ex.cmd.texi} (62%) delete mode 100644 docs/vi.ref/merge.awk delete mode 100644 docs/vi.ref/ref.so create mode 100644 docs/vi.ref/ref.texi rename docs/vi.ref/{set.opt.roff => set.opt.texi} (69%) rename docs/vi.ref/{vi.cmd.roff => vi.cmd.texi} (65%) rename docs/vi.ref/{vi.ref => vi.texi} (59%) diff --git a/docs/vi.ref/Makefile b/docs/vi.ref/Makefile dissimilarity index 79% index bc125a02..f88b560f 100644 --- a/docs/vi.ref/Makefile +++ b/docs/vi.ref/Makefile @@ -1,38 +1,24 @@ -# $Id: Makefile,v 8.22 2001/01/28 15:50:07 skimo Exp $ (Berkeley) $Date: 2001/01/28 15:50:07 $ - -MACROS= -me -ROFF= groff -TBL= tbl - -all: vi.ref.txt vi.ref.ps ../html/vi.ref.html - -vi.ref.txt: vi.ref index.so - soelim vi.ref | ${TBL} | groff ${MACROS} -Tascii > $@ - rm -f index - chmod 444 $@ - -vi.ref.ps: vi.ref index.so - soelim vi.ref | ${TBL} | ${ROFF} ${MACROS} > $@ - rm -f index - chmod 444 $@ - -../html/vi.ref.html: vi.ref index.so - soelim $< | ${TBL} | ${ROFF} ${MACROS} -Thtml | \ - sed 's///' > $@ - rm -f "$<"*png - chmod 444 $@ - -index.so: vi.ref - # Build index.so, side-effect of building the paper. - soelim vi.ref | ${TBL} | ${ROFF} ${MACROS} > /dev/null - sed -e 's/MINUSSIGN/\\-/' \ - -e 's/DOUBLEQUOTE/""/' \ - -e "s/SQUOTE/'/" \ - -e 's/ /__SPACE/g' < index | \ - sort -u '-t ' +0 -1 +1n | awk -f merge.awk | \ - sed -e 's/__SPACE/ /g' > $@ - rm -f index - chmod 444 $@ - -clean: - rm -f vi.ref.ps vi.ref.txt index index.so ../html/vi.ref.html +# $Id: Makefile,v 8.23 2001/08/18 20:43:47 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:47 $ + +MACROS= -me +ROFF= groff +TBL= tbl + +all: vi.ref.txt vi.ref.ps ../html/vi.ref.html + +vi.ref.txt: vi.texi + makeinfo --no-headers vi.ref > $@ 2>/dev/null + chmod 444 $@ + +vi.ref.ps: vi.texi + texi2dvi vi.texi + dvips -o $@ vi.dvi + rm -f vi.dvi + chmod 444 $@ + +../html/vi.ref.html: vi.texi + makeinfo --html vi.ref --output=$@ 2>/dev/null + chmod 444 $@ + +clean: + rm -f vi.ref.ps vi.ref.txt index index.so ../html/vi.ref.html diff --git a/docs/vi.ref/ex.cmd.roff b/docs/vi.ref/ex.cmd.texi similarity index 62% rename from docs/vi.ref/ex.cmd.roff rename to docs/vi.ref/ex.cmd.texi index 7276e970..ba9a9355 100644 --- a/docs/vi.ref/ex.cmd.roff +++ b/docs/vi.ref/ex.cmd.texi @@ -1,403 +1,419 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 1994, 1995, 1996 -.\" Keith Bostic. All rights reserved. -.\" -.\" See the LICENSE file for redistribution information. -.\" -.\" $Id: ex.cmd.roff,v 8.42 2001/01/28 13:48:00 skimo Exp $ (Berkeley) $Date: 2001/01/28 13:48:00 $ -.\" -.SH 1 "Ex Description" -.pp +@comment Copyright (c) 1994 +@comment The Regents of the University of California. All rights reserved. +@comment Copyright (c) 1994, 1995, 1996 +@comment Keith Bostic. All rights reserved. +@comment +@comment See the LICENSE file for redistribution information. +@comment +@comment $Id: ex.cmd.texi,v 8.1 2001/08/18 20:43:47 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:47 $ +@comment +@chapter Ex Description + The following words have special meanings for -.CO ex +@CO{ex} commands. -.KY "" -.IP "" +@itemize @bullet +@cindex "" +@IP{} + The end-of-file character is used to scroll the screen in the -.CO ex +@CO{ex} editor. This character is normally -.LI . +@LI{}. However, whatever character is set for the current terminal is supported as well as -.LI . -.KY "line" -.IP "line" +@LI{}. +@cindex "line" +@IP{line} + A single-line address, given in any of the forms described in the section entitled -.QB "Ex Addressing" . +@QB{Ex Addressing} . The default for -.LI line -is the current line. -.KY "range" -.IP "range" +@LI{line}is the current line. +@cindex "range" +@IP{range} + A line, or a pair of line addresses, separated by a comma or semicolon. (See the section entitled -.QB "Ex Addressing" +@QB{Ex Addressing} for more information.) The default for range is the current line -.i only , +@emph{only}, i.e. -.QT \&.,. . +@QT{.,.}. A percent sign -.PQ % +@PQ{%} stands for the range -.QT 1,$ . +@QT{1,$}. The starting address must be less than, or equal to, the ending address. -.KY "count" -.IP "count" +@cindex "count" +@IP{count} + A positive integer, specifying the number of lines to be affected by the command; the default is 1. Generally, a count past the end-of-file may be specified, e.g. the command -.QT "p 3000" +@QT{p 3000} in a 10 line file is acceptable, and will print from the current line through the last line in the file. -.KY "flags" -.IP "flags" +@cindex "flags" +@IP{flags} + One or more of the characters -.QQ # , -.QQ p , +@QQ{#}, +@QQ{p}, and -.QQ l . +@QQ{l}. When a command that accepts these flags completes, the addressed line(s) are written out as if by the corresponding -.CO # , -.CO l +@CO{#}, +@CO{l} or -.CO p +@CO{p} commands. In addition, any number of -.QT + +@QT{+} or -.QT \- +@QT{-} characters can be specified before, after, or during the flags, in which case the line written is not necessarily the one affected by the command, but rather the line addressed by the offset address specified. The default for -.LI flags -is none. -.KY "file" -.IP "file" +@LI{flags}is none. +@cindex "file" +@IP{file} + A pattern used to derive a pathname; the default is the current file. File names are subjected to normal -.XR sh 1 +@XR{sh,1} word expansions. -.pp +@end itemize + Anywhere a file name is specified, it is also possible to use the special string -.QT /tmp . +@QT{/tmp}. This will be replaced with a temporary file name which can be used for temporary work, e.g. -.QT ":e /tmp" +@QT{:e /tmp} creates and edits a new file. -.pp + If both a count and a range are specified for commands that use either, the starting line for the command is the -.i last +@emph{last} line addressed by the range, and -.LI count - 1 +@LI{count}- 1 subsequent lines are affected by the command, e.g. the command -.QT 2,3p4 +@QT{2,3p4} prints out lines 3, 4, 5 and 6. -.pp + When only a line or range is specified, with no command, the implied command is either a -.CO list , -.CO number +@CO{list}, +@CO{number} or -.CO print +@CO{print} command. The command used is the most recent of the three commands to have been used (including any use as a flag). If none of these commands have been used before, the -.CO print +@CO{print} command is the implied command. When no range or count is specified and the command line is a blank line, the current line is incremented by 1 and then the current line is displayed. -.pp + Zero or more whitespace characters may precede or follow the addresses, count, flags, or command name. Any object following a command name (such as buffer, file, etc.), that begins with an alphabetic character, should be separated from the command name by at least one whitespace character. -.pp + Any character, including -.LI , -.QT % +@LI{}, +@QT{%} and -.QT # +@QT{#} retain their literal value when preceded by a backslash. -.SH 1 "Ex Commands" -.pp +@chapter Ex Commands + The following section describes the commands available in the -.CO ex +@CO{ex} editor. In each entry below, the tag line is a usage synopsis for the command. -.pp + Each command can be entered as the abbreviation (those characters in the synopsis command word preceding the -.QQ [ +@QQ{[} character), the full command (all characters shown for the command word, omitting the -.QQ [ +@QQ{[} and -.QQ ] +@QQ{]} characters), or any leading subset of the full command down to the abbreviation. For example, the args command (shown as -.QT ar[gs] +@QT{ar[gs]} in the synopsis) can be entered as -.QT ar , -.QT arg +@QT{ar}, +@QT{arg} or -.QT args . -.pp +@QT{args}. + Each -.CO ex +@CO{ex} command described below notes the new current line after it is executed, as well as any options that affect the command. -.\" I cannot get a double quote to print to save my life. The ONLY way -.\" I've been able to get this to work is with the .tr command. -.tr Q" -.ds ms Q -.KY DOUBLEQUOTE -.IP "\*(ms" -.tr QQ +@cindex DOUBLEQUOTE +@deftypefn Command {} {"} + A comment. Command lines beginning with the double-quote character -.PQ """" +@PQ{"} are ignored. This permits comments in editor scripts and startup files. -.KY "" -.KY "" -.IP "" -.IP "" +@end deftypefn +@cindex "" +@cindex "" +@deftypefn Command {} {} + +@deftypefnx Command {} {} + Scroll the screen. Write the next N lines, where N is the value of the -.OP scroll +@OP{scroll} option. The command is the end-of-file terminal character, which may be different on different terminals. Traditionally, it is the -.LI -key. -.sp +@LI{}key. +@sp 1 Historically, the -.CO eof +@CO{eof} command ignored any preceding count, and the -.LI -character was ignored unless it was entered as the first character +@LI{}character was ignored unless it was entered as the first character of the command. This implementation treats it as a command -.i only +@emph{only} if entered as the first character of the command line, and otherwise treats it as any other character. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line written. -.SP Options: +@item Options: Affected by the -.OP scroll +@OP{scroll} option. -.SE -.KY "!" -.IP "! argument(s)" -.Ip "[range]! argument(s)" +@end table +@end deftypefn +@cindex "!" +@deftypefn Command {} {!} {argument(s)} + +@deftypefnx Command {} {[range]!} {argument(s)} Execute a shell command, or filter lines through a shell command. In the first synopsis, the remainder of the line after the -.QT ! +@QT{!} character is passed to the program named by the -.OP shell +@OP{shell} option, as a single argument. -.sp +@sp 1 Within the rest of the line, -.QT % +@QT{%} and -.QT # +@QT{#} are expanded into the current and alternate pathnames, respectively. The character -.QT ! +@QT{!} is expanded with the command text of the previous -.CO ! +@CO{!} command. (Therefore, the command -.CO !! +@CO{!!} repeats the previous -.CO ! +@CO{!} command.) The special meanings of -.QT % , -.QT # , +@QT{%}, +@QT{#}, and -.QT ! +@QT{!} can be overridden by escaping them with a backslash. If no -.CO ! +@CO{!} or -.CO :! +@CO{:!} command has yet been executed, it is an error to use an unescaped -.QT ! +@QT{!} character. The -.CO ! +@CO{!} command does -.i not +@emph{not} do shell expansion on the strings provided as arguments. If any of the above expansions change the command the user entered, the command is redisplayed at the bottom of the screen. -.sp -.CO Ex +@sp 1 +@CO{Ex} then executes the program named by the -.OP shell +@OP{shell} option, with a -.b \-c +@strong{-c} flag followed by the arguments (which are bundled into a single argument). -.sp +@sp 1 The -.CO ! +@CO{!} command is permitted in an empty file. -.sp +@sp 1 If the file has been modified since it was last completely written, the -.CO ! +@CO{!} command will warn you. -.sp +@sp 1 A single -.QT ! +@QT{!} character is displayed when the command completes. -.sp +@sp 1 In the second form of the -.CO ! +@CO{!} command, the remainder of the line after the -.QT ! +@QT{!} is passed to the program named by the -.OP shell +@OP{shell} option, as described above. The specified lines are passed to the program as standard input, and the standard and standard error output of the program replace the original lines. -.SS -.SP Line: +@table @asis +@item Line: Unchanged if no range was specified, otherwise set to the first line of the range. -.SP Options: +@item Options: Affected by the -.OP shell +@OP{shell} and -.OP warn +@OP{warn} options. -.SE -.KY "#" -.IP "[range] # [count] [flags]" -.KY "number" -.Ip "[range] nu[mber] [count] [flags]" +@end table +@end deftypefn +@cindex "#" +@deftypefn Command {[range]} {#} {[count] [flags]} + +@cindex "number" +@deftypefnx Command {[range]} {nu[mber]} {[count] [flags]} Display the selected lines, each preceded with its line number. -.sp +@sp 1 The line number format is -.QQ %6d , +@QQ{%6d}, followed by two spaces. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line displayed. -.SP Options: +@item Options: Affected by the -.OP list +@OP{list} option. -.SE -.KY "@" -.IP "@ buffer" -.KY "*" -.Ip "* buffer" +@end table +@end deftypefn +@cindex "@@" +@deftypefn Command {@@} {buffer} + +@cindex "*" +@deftypefnx Command {} {*} {buffer} Execute a buffer. Each line in the named buffer is executed as an -.CO ex +@CO{ex} command. If no buffer is specified, or if the specified buffer is -.QT @ +@QT{@@} or -.QT * , +@QT{*}, the last buffer executed is used. -.KY < -.IP "[range] <[< ...] [count] [flags]" +@end deftypefn +@cindex < +@deftypefn Command {[range]} {<[< ...]} {[count] [flags]} + Shift lines left or right. The specified lines are shifted to the left (for the -.CO < +@CO{<} command) or right (for the -.CO > +@CO{>} command), by the number of columns specified by the -.OP shiftwidth +@OP{shiftwidth} option. Only leading whitespace characters are deleted when shifting left; once the first column of the line contains a nonblank character, the -.CO shift +@CO{shift} command will succeed, but the line will not be modified. -.sp +@sp 1 If the command character -.CO < +@CO{<} or -.CO > +@CO{>} is repeated more than once, the command is repeated once for each additional command character. -.SS -.SP Line: +@table @asis +@item Line: If the current line is set to one of the lines that are affected by the command, it is unchanged. Otherwise, it is set to the first nonblank character of the lowest numbered line shifted. -.SP Options: +@item Options: Affected by the -.OP shiftwidth +@OP{shiftwidth} option. -.SE -.KY = -.IP "[line] = [flags]" +@end table +@end deftypefn +@cindex = +@deftypefn Command {[line]} {=} {[flags]} + Display the line number of -.LI line -(which defaults to the last line in the file). -.SS -.SP Line: +@LI{line}(which defaults to the last line in the file). +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY > -.IP "[range] >[> ...] [count] [flags]" +@end table +@end deftypefn +@cindex > +@deftypefn Command {[range]} {>[> ...]} {[count] [flags]} + Shift right. The specified lines are shifted to the right by the number of columns specified by the -.OP shiftwidth +@OP{shiftwidth} option, by inserting tab and space characters. Empty lines are not changed. -.sp +@sp 1 If the command character -.QT > +@QT{>} is repeated more than once, the command is repeated once for each additional command character. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line modified by the command. -.SP Options: +@item Options: Affected by the -.OP shiftwidth +@OP{shiftwidth} option. -.SE -.KY abbrev -.IP "ab[brev] lhs rhs" +@end table +@end deftypefn +@cindex abbrev +@deftypefn Command {} {ab[brev]} {lhs rhs} + Add an abbreviation to the current abbreviation list. When inserting text in -.CO vi , +@CO{vi}, each time a non-word character is entered after a word character, a set of characters ending at the word character are checked for a match with -.LI lhs . +@LI{lhs}. If a match is found, they are replaced with -.LI rhs . +@LI{rhs}. The set of characters that are checked for a match are defined as follows, for inexplicable historical reasons. If only one or two characters were entered before the non-word character @@ -405,322 +421,328 @@ that triggered the check, and after the beginning of the insertion, or the beginning of the line or the file, or the last -.LI -character that was entered, +@LI{}character that was entered, then the one or the both characters are checked for a match. Otherwise, the set includes both characters, as well as the characters that precede them that are the same word class (i.e. word or non-word) as the -.b second +@strong{second} to last character entered before the non-word character that triggered the check, back to the first -.LI character, +@LI{}character, the beginning of the insertion, or the beginning of the line or the file. -.sp +@sp 1 For example, the abbreviations: -.sp -.ne 3v -.ft C -.TS -r l l. -:abbreviate abc ABC -:abbreviate #i #include -:abbreviate /*#i /*#include -.TE -.ft R +@sp 1 +@multitable {:abbreviate} {/*#i} {/********************} +@item :abbreviate @tab abc @tab ABC +@item :abbreviate @tab #i @tab #include +@item :abbreviate @tab /*#i @tab /*#include +@end multitable will all work, while the abbreviations: -.sp -.ne 2v -.ft C -.TS -r l l. -:abbreviate a#i A#include -:abbreviate /* /******************** -.TE -.ft R +@sp 1 +@multitable {:abbreviate} {/*#i} {/********************} +@item :abbreviate @tab a#i @tab A#include +@item :abbreviate @tab /* @tab /******************** +@end multitable will not work, and are not permitted by -.CO nvi . -.sp +@CO{nvi}. +@sp 1 To keep the abbreviation expansion from happening, the character immediately following the -.LI lhs -characters should be quoted with a -.LI -character. -.sp +@LI{lhs}characters should be quoted with a +@LI{}character. +@sp 1 The replacement -.LI rhs -is itself subject to both further abbreviation expansion and further +@LI{rhs}is itself subject to both further abbreviation expansion and further map expansion. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY append -.IP "[line] a[ppend][!]" +@end table +@end deftypefn +@cindex append +@deftypefn Command {[line]} {a[ppend][!]} + The input text is appended to the specified line. If line 0 is specified, the text is inserted at the beginning of the file. Set to the last line input. If no lines are input, then set to -.LI line , +@LI{line}, or to the first line of the file if a -.LI line -of 0 was specified. +@LI{line}of 0 was specified. Following the command name with a -.QT ! +@QT{!} character causes the -.OP autoindent +@OP{autoindent} option to be toggled for the duration of the command. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP autoindent +@OP{autoindent} and -.OP number +@OP{number} options. -.SE -.KY args -.IP "ar[gs]" +@end table +@end deftypefn +@cindex args +@deftypefn Command {} {ar[gs]} + Display the argument list. The current argument is displayed inside of -.QT [ +@QT{[} and -.QT ] +@QT{]} characters. The argument list is the list of operands specified on startup, which can be replaced using the -.CO next +@CO{next} command. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY bg -.IP bg -.CO Vi +@end table +@end deftypefn +@cindex bg +@deftypefn Command {} {bg} + +@CO{Vi} mode only. Background the current screen. The screen is unchanged, but is no longer accessible and disappears from the display. Use the -.CO fg +@CO{fg} command to bring the screen back to the display foreground. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line when the screen was last edited. -.SP Options: +@item Options: None. -.SE -.KY change -.IP "[range] c[hange][!] [count]" +@end table +@end deftypefn +@cindex change +@deftypefn Command {[range]} {c[hange][!]} {[count]} + Replace the lines with input text. Following the command name with a -.QT ! +@QT{!} character causes the -.OP autoindent +@OP{autoindent} option to be toggled for the duration of the command. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line input, or, if no lines were input, set to the line before the target line, or to the first line of the file if there are no lines preceding the target line. -.SP Options: +@item Options: Affected by the -.OP autoindent +@OP{autoindent} and -.OP number +@OP{number} options. -.SE -.KY cd -.KY chdir -.IP "chd[ir][!] [directory]" -.Ip "cd[!] [directory]" +@end table +@cindex cd +@end deftypefn +@cindex chdir +@deftypefn Command {} {chd[ir][!]} {[directory]} + +@deftypefnx Command {} {cd[!]} {[directory]} Change the current working directory. The -.LI directory -argument is subjected to -.XR sh 1 +@LI{directory}argument is subjected to +@XR{sh,1} word expansions. When invoked with no directory argument and the -.LI HOME -environment variable is set, the directory named by the -.LI HOME -environment variable becomes the new current directory. +@LI{HOME}environment variable is set, the directory named by the +@LI{HOME}environment variable becomes the new current directory. Otherwise, the new current directory becomes the directory returned by the -.XR getpwent 3 +@XR{getpwent,3} routine. -.sp +@sp 1 The -.CO chdir +@CO{chdir} command will fail if the file has been modified since the last complete write of the file. You can override this check by appending a -.QT ! +@QT{!} character to the command. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP cdpath +@OP{cdpath} option. -.SE -.KY copy -.KY t -.IP "[range] co[py] line [flags]" -.Ip "[range] t line [flags]" +@end table +@cindex copy +@end deftypefn +@cindex t +@deftypefn Command {[range]} {co[py]} {line [flags]} + +@deftypefnx Command {[range]} {t} {line [flags]} Copy the specified lines (range) after the destination line. Line 0 may be specified to insert the lines at the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY cscope -.IP "cs[cope] command [args]" +@end table +@end deftypefn +@cindex cscope +@deftypefn Command {} {cs[cope]} {command [args]} + Execute a -.CO cscope +@CO{cscope} command. For more information, see the section of the reference manual entitled -.QB "Tags, Tag Stacks, and Cscope" . -.KY delete -.IP "[range] d[elete] [buffer] [count] [flags]" +@QB{Tags, Tag Stacks, and Cscope} . +@end deftypefn +@cindex delete +@deftypefn Command {[range]} {d[elete]} {[buffer] [count] [flags]} + Delete the lines from the file. The deleted text is saved in the specified buffer, or, if no buffer is specified, in the unnamed buffer. If the command name is followed by a letter that could be interpreted as either a buffer name or a flag value (because neither a -.LI count -or -.LI flags -values were given), -.CO ex +@LI{count}or +@LI{flags}values were given), +@CO{ex} treats the letter as a -.LI flags -value if the letter immediately follows the command name, +@LI{flags}value if the letter immediately follows the command name, without any whitespace separation. If the letter is preceded by whitespace characters, it treats it as a buffer name. -.SS -.SP Line: +@table @asis +@item Line: Set to the line following the deleted lines, or to the last line if the deleted lines were at the end. -.SP Options: +@item Options: None. -.SE -.KY display -.IP "di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]" +@end table +@end deftypefn +@cindex display +@deftypefn Command {} {di[splay]} {b[uffers] | c[onnections] | s[creens] | t[ags]} + Display buffers, -.CO cscope +@CO{cscope} connections, screens or tags. The -.CO display +@CO{display} command takes one of three additional arguments, which are as follows: -.SS -.SP b[uffers] +@table @asis +@item b[uffers] Display all buffers (including named, unnamed, and numeric) that contain text. -.SP c[onnections] +@item c[onnections] Display the source directories for all attached -.CO cscope +@CO{cscope} databases. -.SP s[creens] +@item s[creens] Display the file names of all background screens. -.SP t[ags] +@item t[ags] Display the tags stack. -.SE -.SS -.SP Line: +@end table +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY edit -.IP "e[dit][!] [+cmd] [file]" -.Ip "ex[!] [+cmd] [file]" +@end table +@end deftypefn +@cindex edit +@deftypefn Command {} {e[dit][!]} {[+cmd] [file]} + +@deftypefnx Command {} {ex[!]} {[+cmd] [file]} Edit a different file. If the current buffer has been modified since the last complete write, the command will fail. You can override this by appending a -.QT ! +@QT{!} character to the command name. -.sp +@sp 1 If the -.QT +cmd +@QT{+cmd} option is specified, that -.CO ex +@CO{ex} command will be executed in the new file. Any -.CO ex +@CO{ex} command may be used, although the most common use of this feature is to specify a line number or search pattern to set the initial location in the new file. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Edit +@CO{Edit} or -.CO Ex , +@CO{Ex}, while in -.CO vi +@CO{vi} mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: If you have previously edited the file, the current line will be set to your last position in the file. If that position does not exist, or you have not previously edited the file, the current line will be set to the first line of the file if you are in -.CO vi +@CO{vi} mode, and the last line of the file if you are in -.CO ex . -.SP Options: +@CO{ex}. +@item Options: None. -.SE -.KY exusage -.IP "exu[sage] [command]" +@end table +@end deftypefn +@cindex exusage +@deftypefn Command {} {exu[sage]} {[command]} + Display usage for an -.CO ex +@CO{ex} command. If -.LI command -is specified, a usage statement for that command is displayed. +@LI{command}is specified, a usage statement for that command is displayed. Otherwise, usage statements for all -.CO ex +@CO{ex} commands are displayed. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY file -.IP "f[ile] [file]" +@end table +@end deftypefn +@cindex file +@deftypefn Command {} {f[ile]} {[file]} + Display and optionally change the file name. If a file name is specified, the current pathname is changed to the specified name. The current pathname, the number of lines, and the current position in the file are displayed. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY fg -.IP "fg [name]" -.CO Vi +@end table +@end deftypefn +@cindex fg +@deftypefn Command {} {fg} {[name]} + +@CO{Vi} mode only. Foreground the specified screen. If the argument name doesn't exactly match the name of a file displayed @@ -728,1197 +750,1232 @@ by a background screen, it is compared against the last component of each of the file names. If no background screen is specified, the first background screen is foregrounded. -.sp +@sp 1 By default, foregrounding causes the current screen to be swapped with the backgrounded screen. Capitalizing the first letter of the command, i.e. -.CO Fg , +@CO{Fg}, will foreground the backgrounded screen in a new screen instead of swapping it with the current screen. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line when the screen was last edited. -.SP Options: +@item Options: None. -.SE -.KY global -.IP "[range] g[lobal] /pattern/ [commands]" -.KY v -.Ip "[range] v /pattern/ [commands]" +@end table +@end deftypefn +@cindex global +@deftypefn Command {[range]} {g[lobal]} {/pattern/ [commands]} + +@cindex v +@deftypefnx Command {[range]} {v} {/pattern/ [commands]} Apply commands to lines matching (or not matching) a pattern. The lines within the given range that match -.PQ g[lobal] , +@PQ{g[lobal]}, or do not match -.PQ v +@PQ{v} the given pattern are selected. Then, the specified -.CO ex +@CO{ex} command(s) are executed with the current line -.PQ \&. +@PQ{.} set to each selected line. If no range is specified, the entire file is searched for matching, or not matching, lines. -.sp +@sp 1 Multiple commands can be specified, one per line, by escaping each -.LI -character with a backslash, or by separating commands with a -.QT | +@LI{}character with a backslash, or by separating commands with a +@QT{|} character. If no commands are specified, the command defaults to the -.CO print +@CO{print} command. -.sp +@sp 1 For the -.CO append , -.CO change +@CO{append}, +@CO{change} and -.CO insert +@CO{insert} commands, the input text must be part of the global command line. In this case, the terminating period can be omitted if it ends the commands. -.sp +@sp 1 The -.CO visual +@CO{visual} command may also be specified as one of the -.CO ex +@CO{ex} commands. In this mode, input is taken from the terminal. Entering a -.CO Q +@CO{Q} command in -.CO vi +@CO{vi} mode causes the next line matching the pattern to be selected and -.CO vi +@CO{vi} to be reentered, until the list is exhausted. -.sp +@sp 1 The -.CO global , -.CO v +@CO{global}, +@CO{v} and -.CO undo +@CO{undo} commands cannot be used as part of these commands. -.sp +@sp 1 The editor options -.OP autoindent , -.OP autoprint +@OP{autoindent}, +@OP{autoprint} and -.OP report +@OP{report} are turned off for the duration of the -.CO global +@CO{global} and -.CO v +@CO{v} commands. -.SS -.SP Line: +@table @asis +@item Line: The last line modified. -.SP Options: +@item Options: Affected by the -.OP ignorecase +@OP{ignorecase} and -.OP magic +@OP{magic} options. Turns off the -.OP autoindent , -.OP autoprint +@OP{autoindent}, +@OP{autoprint} and -.OP report +@OP{report} options. -.SE -.KY help -.IP "he[lp]" +@end table +@end deftypefn +@cindex help +@deftypefn Command {} {he[lp]} + Display a help message. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY insert -.IP "[line] i[nsert][!]" +@end table +@end deftypefn +@cindex insert +@deftypefn Command {[line]} {i[nsert][!]} + The input text is inserted before the specified line. Following the command name with a -.QT ! +@QT{!} character causes the -.OP autoindent +@OP{autoindent} option setting to be toggled for the duration of this command. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line input; if no lines were input, set to the line before the target line, or to the first line of the file if there are no lines preceding the target line. Affected by the -.OP autoindent +@OP{autoindent} and -.OP number +@OP{number} options. -.SE -.KY join -.IP "[range] j[oin][!] [count] [flags]" +@end table +@end deftypefn +@cindex join +@deftypefn Command {[range]} {j[oin][!]} {[count] [flags]} + Join lines of text together. -.sp +@sp 1 A -.LI count -specified to the -.CO join +@LI{count}specified to the +@CO{join} command specifies that the last line of the -.LI range -plus -.LI count -subsequent lines will be joined. +@LI{range}plus +@LI{count}subsequent lines will be joined. (Note, this differs by one from the general rule where only -.LI count - 1 +@LI{count}- 1 subsequent lines are affected.) -.sp +@sp 1 If the current line ends with a whitespace character, all whitespace is stripped from the next line. Otherwise, if the next line starts with a open parenthesis -.PQ ( , +@PQ{(}, do nothing. Otherwise, if the current line ends with a question mark -.PQ ? , +@PQ{?}, period -.PQ \&. +@PQ{.} or exclamation point -.PQ ! , +@PQ{!}, insert two spaces. Otherwise, insert a single space. -.sp +@sp 1 Appending a -.QT ! +@QT{!} character to the command name causes a simpler join with no white-space processing. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY list -.IP "[range] l[ist] [count] [flags]" +@end table +@end deftypefn +@cindex list +@deftypefn Command {[range]} {l[ist]} {[count] [flags]} + Display the lines unambiguously. Tabs are displayed as -.QT ^I , +@QT{^I}, and the end of the line is marked with a -.QT $ +@QT{$} character. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line displayed. -.SP Options: +@item Options: Affected by the -.OP number +@OP{number} option. -.SE -.KY map -.IP "map[!] [lhs rhs]" +@end table +@end deftypefn +@cindex map +@deftypefn Command {} {map[!]} {[lhs rhs]} + Define or display maps (for -.CO vi +@CO{vi} only). -.sp +@sp 1 If -.QT lhs +@QT{lhs} and -.QT rhs +@QT{rhs} are not specified, the current set of command mode maps are displayed. If a -.QT ! +@QT{!} character is appended to to the command, the text input mode maps are displayed. -.sp +@sp 1 Otherwise, when the -.QT lhs +@QT{lhs} character sequence is entered in -.CO vi , +@CO{vi}, the action is as if the corresponding -.QT rhs +@QT{rhs} had been entered. If a -.QT ! +@QT{!} character is appended to the command name, the mapping is effective during text input mode, otherwise, it is effective during command mode. This allows -.QT lhs +@QT{lhs} to have two different macro definitions at the same time: one for command mode and one for input mode. -.sp +@sp 1 Whitespace characters require escaping with a -.LI -character to be entered in the -.LI lhs -string in visual mode. -.sp +@LI{}character to be entered in the +@LI{lhs}string in visual mode. +@sp 1 Normally, keys in the -.LI rhs -string are remapped (see the -.OP remap +@LI{rhs}string are remapped (see the +@OP{remap} option), and it is possible to create infinite loops. However, keys which map to themselves are not further remapped, regardless of the setting of the -.OP remap +@OP{remap} option. For example, the command -.QT ":map n nz." +@QT{:map n nz.} maps the -.QT n +@QT{n} key to the -.CO n +@CO{n} and -.CO z +@CO{z} commands. -.sp +@sp 1 To exit an infinitely looping map, use the terminal -.LI -character. -.SS -.SP Line: +@LI{}character. +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP remap +@OP{remap} option. -.SE -.KY mark -.KY k -.IP "[line] ma[rk] " -.Ip "[line] k " +@end table +@cindex mark +@end deftypefn +@cindex k +@deftypefn Command {[line]} {ma[rk]} {} + +@deftypefnx Command {[line]} {k} {} Mark the line with the mark -.LI . +@LI{}. The expressions -.QT ' +@QT{'} and -.QT ` +@QT{`} can then be used as an address in any command that uses one. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY move -.IP "[range] m[ove] line" +@end table +@end deftypefn +@cindex move +@deftypefn Command {[range]} {m[ove]} {line} + Move the specified lines after the target line. A target line of 0 places the lines at the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the first of the moved lines. -.SP Options: +@item Options: None. -.SE -.KY mkexrc -.IP "mk[exrc][!] file" +@end table +@end deftypefn +@cindex mkexrc +@deftypefn Command {} {mk[exrc][!]} {file} + Write the abbreviations, editor options and maps to the specified file. Information is written in a form which can later be read back in using the -.CO ex -.CO source +@CO{ex} +@CO{source} command. If -.LI file -already exists, the -.CO mkexrc +@LI{file}already exists, the +@CO{mkexrc} command will fail. This check can be overridden by appending a -.QT ! +@QT{!} character to the command. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY next -.IP "n[ext][!] [file ...]" +@end table +@end deftypefn +@cindex next +@deftypefn Command {} {n[ext][!]} {[file ...]} + Edit the next file from the argument list. The -.CO next +@CO{next} command will fail if the file has been modified since the last complete write. This check can be overridden by appending the -.QT ! +@QT{!} character to the command name. The argument list can optionally be replaced by specifying a new one as arguments to this command. In this case, editing starts with the first file on the new list. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Next , +@CO{Next}, while in -.CO vi +@CO{vi} mode, will set the argument list and edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: Set as described for the -.CO edit +@CO{edit} command. -.SP Options: +@item Options: Affected by the options -.OP autowrite +@OP{autowrite} and -.OP writeany . -.SE -.KY open -.IP "[line] o[pen] /pattern/ [flags]" +@OP{writeany}. +@end table +@end deftypefn +@cindex open +@deftypefn Command {[line]} {o[pen]} {/pattern/ [flags]} + Enter open mode. Open mode is the same as being in -.CO vi , +@CO{vi}, but with a one-line window. All the standard -.CO vi +@CO{vi} commands are available. If a match is found for the optional RE argument, the cursor is set to the start of the matching pattern. -.sp -.i "This command is not yet implemented." -.SS -.SP Line: +@sp 1 +@emph{This command is not yet implemented.} +@table @asis +@item Line: Unchanged, unless the optional RE is specified, in which case it is set to the line where the matching pattern is found. -.SP Options: +@item Options: Affected by the -.OP open +@OP{open} option. -.SE -.KY preserve -.IP "pre[serve]" +@end table +@end deftypefn +@cindex preserve +@deftypefn Command {} {pre[serve]} + Save the file in a form that can later be recovered using the -.CO ex -.b \-r +@CO{ex} +@strong{-r} option. When the file is preserved, an email message is sent to the user. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY previous -.IP "prev[ious][!]" +@end table +@end deftypefn +@cindex previous +@deftypefn Command {} {prev[ious][!]} + Edit the previous file from the argument list. The -.CO previous +@CO{previous} command will fail if the file has been modified since the last complete write. This check can be overridden by appending the -.QT ! +@QT{!} character to the command name. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Previous , +@CO{Previous}, while in -.CO vi +@CO{vi} mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: Set as described for the -.CO edit +@CO{edit} command. -.SP Options: +@item Options: Affected by the options -.OP autowrite +@OP{autowrite} and -.OP writeany . +@OP{writeany}. None. -.SE -.KY print -.IP "[range] p[rint] [count] [flags]" +@end table +@end deftypefn +@cindex print +@deftypefn Command {[range]} {p[rint]} {[count] [flags]} + Display the specified lines. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line displayed. -.SP Options: +@item Options: Affected by the -.OP list +@OP{list} and -.OP number +@OP{number} option. -.SE -.KY put -.IP "[line] pu[t] [buffer]" +@end table +@end deftypefn +@cindex put +@deftypefn Command {[line]} {pu[t]} {[buffer]} + Append buffer contents to the current line. If a buffer is specified, its contents are appended to the line, otherwise, the contents of the unnamed buffer are used. -.SS -.SP Line: +@table @asis +@item Line: Set to the line after the current line. -.SP Options: +@item Options: None. -.SE -.KY quit -.IP "q[uit][!]" +@end table +@end deftypefn +@cindex quit +@deftypefn Command {} {q[uit][!]} + End the editing session. If the file has been modified since the last complete write, the -.CO quit +@CO{quit} command will fail. This check may be overridden by appending a -.QT ! +@QT{!} character to the command. -.sp +@sp 1 If there are more files to edit, the -.CO quit +@CO{quit} command will fail. Appending a -.QT ! +@QT{!} character to the command name or entering two -.CO quit +@CO{quit} commands (i.e. -.CO wq , -.CO quit , -.CO xit +@CO{wq}, +@CO{quit}, +@CO{xit} or -.CO ZZ ) +@CO{ZZ}) in a row) will override this check and the editor will exit. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY read -.IP "[line] r[ead][!] [file]" +@end table +@end deftypefn +@cindex read +@deftypefn Command {[line]} {r[ead][!]} {[file]} + Read a file. A copy of the specified file is appended to the line. If -.LI line -is 0, the copy is inserted at the beginning of the file. +@LI{line}is 0, the copy is inserted at the beginning of the file. If no file is specified, the current file is read; if there is no current file, then -.LI file -becomes the current file. +@LI{file}becomes the current file. If there is no current file and no -.LI file -is specified, then the -.CO read +@LI{file}is specified, then the +@CO{read} command will fail. -.sp +@sp 1 If -.LI file -is preceded by a -.QT ! +@LI{file}is preceded by a +@QT{!} character, -.LI file -is treated as if it were a shell command, and passed to the program +@LI{file}is treated as if it were a shell command, and passed to the program named by the -.OP shell +@OP{shell} edit option. The standard and standard error outputs of that command are read into the file after the specified line. The special meaning of the -.QT ! +@QT{!} character can be overridden by escaping it with a backslash -.PQ \e +@PQ{\e} character. -.SS -.SP Line: +@table @asis +@item Line: When executed from -.CO ex , +@CO{ex}, the current line is set to the last line read. When executed from -.CO vi , +@CO{vi}, the current line is set to the first line read. -.SP Options: +@item Options: None. -.SE -.KY recover -.IP "rec[over] file" +@end table +@end deftypefn +@cindex recover +@deftypefn Command {} {rec[over]} {file} + Recover -.LI file -if it was previously saved. +@LI{file}if it was previously saved. If no saved file by that name exists, the -.CO recover +@CO{recover} command behaves equivalently to the -.CO edit +@CO{edit} command. -.SS -.SP Line: +@table @asis +@item Line: Set as described for the -.CO edit +@CO{edit} command. -.SP Options: +@item Options: None. -.SE -.KY resize -.IP "res[ize] [+|-]size" -.CO Vi +@end table +@end deftypefn +@cindex resize +@deftypefn Command {} {res[ize]} {[+|-]size} + +@CO{Vi} mode only. Grow or shrink the current screen. If -.LI size -is a positive, signed number, the current screen is grown by that many lines. +@LI{size}is a positive, signed number, the current screen is grown by that many lines. If -.LI size -is a negative, signed number, the current screen is shrunk by that many lines. +@LI{size}is a negative, signed number, the current screen is shrunk by that many lines. If -.LI size -is not signed, the current screen is set to the specified -.LI size . +@LI{size}is not signed, the current screen is set to the specified +@LI{size}. Applicable only to split screens. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY rewind -.IP "rew[ind][!]" +@end table +@end deftypefn +@cindex rewind +@deftypefn Command {} {rew[ind][!]} + Rewind the argument list. If the current file has been modified since the last complete write, the -.CO rewind +@CO{rewind} command will fail. This check may be overridden by appending the -.QT ! +@QT{!} character to the command. -.sp +@sp 1 Otherwise, the current file is set to the first file in the argument list. -.SS -.SP Line: +@table @asis +@item Line: Set as described for the -.CO edit +@CO{edit} command. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY set -.IP "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]" +@end table +@end deftypefn +@cindex set +@deftypefn Command {} {se[t]} {[option[=[value]] ...] [nooption ...] [option? ...] [all]} + Display or set editor options. When no arguments are specified, the editor option -.OP term , +@OP{term}, and any editor options whose values have been changed from the default settings are displayed. If the argument -.LI all -is specified, the values of all of editor options are displayed. -.sp +@LI{all}is specified, the values of all of editor options are displayed. +@sp 1 Specifying an option name followed by the character -.QT ? +@QT{?} causes the current value of that option to be displayed. The -.QT ? +@QT{?} can be separated from the option name by whitespace characters. The -.QT ? +@QT{?} is necessary only for Boolean valued options. Boolean options can be given values by the form -.QT "set option" +@QT{set option} to turn them on, or -.QT "set nooption" +@QT{set nooption} to turn them off. String and numeric options can be assigned by the form -.QT "set option=value" . +@QT{set option=value}. Any whitespace characters in strings can be included literally by preceding each with a backslash. More than one option can be set or listed by a single set command, by specifying multiple arguments, each separated from the next by whitespace characters. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY shell -.IP "sh[ell]" +@end table +@end deftypefn +@cindex shell +@deftypefn Command {} {sh[ell]} + Run the shell program. The program named by the -.OP shell +@OP{shell} option is run with a -.b \-i +@strong{-i} (for interactive) flag. Editing is resumed when that program exits. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP shell +@OP{shell} option. -.SE -.KY source -.IP "so[urce] file" +@end table +@end deftypefn +@cindex source +@deftypefn Command {} {so[urce]} {file} + Read and execute -.CO ex +@CO{ex} commands from a file. -.CO Source +@CO{Source} commands may be nested. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY substitute -.IP "[range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]" -.KY & -.Ip "[range] & [options] [count] [flags]" -.KY ~ -.Ip "[range] ~ [options] [count] [flags]" +@end table +@end deftypefn +@cindex substitute +@deftypefn Command {[range]} {s[ubstitute]} {[/pattern/replace/] [options] [count] [flags]} + +@cindex & +@deftypefnx Command {[range]} {&} {[options] [count] [flags]} +@cindex ~ +@deftypefnx Command {[range]} {~} {[options] [count] [flags]} Make substitutions. Replace the first instance of -.LI pattern -with the string -.LI replace -on the specified line(s). +@LI{pattern}with the string +@LI{replace}on the specified line(s). If the -.QT /pattern/repl/ +@QT{/pattern/repl/} argument is not specified, the -.QT /pattern/repl/ +@QT{/pattern/repl/} from the previous -.CO substitute +@CO{substitute} command is used. Any character other than an alphabetic, numeric, or backslash character may be used as the delimiter. -.sp +@sp 1 If -.LI options -includes the letter -.QT c +@LI{options}includes the letter +@QT{c} (confirm), you will be prompted for confirmation before each replacement is done. An affirmative response (in English, a -.QT y +@QT{y} character) causes the replacement to be made. A quit response (in English, a -.QT q +@QT{q} character) causes the -.CO substitute +@CO{substitute} command to be terminated. Any other response causes the replacement not to be made, and the -.CO substitute +@CO{substitute} command continues. If -.LI options -includes the letter -.QT g +@LI{options}includes the letter +@QT{g} (global), all nonoverlapping instances of -.LI pattern -in the line are replaced. -.sp +@LI{pattern}in the line are replaced. +@sp 1 The -.CO & +@CO{&} version of the command is the same as not specifying a pattern or replacement string to the -.CO substitute +@CO{substitute} command, and the -.QT & +@QT{&} is replaced by the pattern and replacement information from the previous substitute command. -.sp +@sp 1 The -.CO ~ +@CO{~} version of the command is the same as -.CO & +@CO{&} and -.CO s , +@CO{s}, except that the search pattern used is the last RE used in -.i any +@emph{any} command, not necessarily the one used in the last -.CO substitute +@CO{substitute} command. -.sp +@sp 1 For example, in the sequence -.ft C -.(b +@example s/red/blue/ /green ~ -.)b -.ft R +@end example the -.QT ~ +@QT{~} is equivalent to -.QT s/green/blue/ . -.sp +@QT{s/green/blue/}. +@sp 1 The -.CO substitute +@CO{substitute} command may be interrupted, using the terminal interrupt character. All substitutions completed before the interrupt are retained. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line upon which a substitution was made. -.SP Options: +@item Options: Affected by the -.OP ignorecase +@OP{ignorecase} and -.OP magic +@OP{magic} option. -.SE -.KY suspend -.IP "su[spend][!]" -.KY stop -.Ip "st[op][!]" -.KY -.Ip +@end table +@end deftypefn +@cindex suspend +@deftypefn Command {} {su[spend][!]} + +@cindex stop +@deftypefnx Command {} {st[op][!]} +@deftypefnx Comamnd {} Suspend the edit session. Appending a -.QT ! +@QT{!} character to these commands turns off the -.OP autowrite +@OP{autowrite} option for the command. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY tag -.IP "ta[g][!] tagstring" +@end table +@end deftypefn +@cindex tag +@deftypefn Command {} {ta[g][!]} {tagstring} + Edit the file containing the specified tag. If the tag is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the -.CO tag +@CO{tag} command will fail. This check can be overridden by appending the -.QT ! +@QT{!} character to the command name. -.sp +@sp 1 The -.CO tag +@CO{tag} command searches for -.LI tagstring -in the tags file(s) specified by the -.OP tags +@LI{tagstring}in the tags file(s) specified by the +@OP{tags} option. (See -.XR ctags 1 +@XR{ctags,1} for more information on tags files.) -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Tag , +@CO{Tag}, while in -.CO vi +@CO{vi} mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the line indicated by the tag. -.SP Options: +@item Options: Affected by the -.OP autowrite , -.OP taglength , -.OP tags +@OP{autowrite}, +@OP{taglength}, +@OP{tags} and -.OP writeany +@OP{writeany} options. -.SE -.KY tagnext -.IP "tagn[ext][!]" +@end table +@end deftypefn +@cindex tagnext +@deftypefn Command {} {tagn[ext][!]} + Edit the file containing the next context for the current tag. If the context is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the -.CO tagnext +@CO{tagnext} command will fail. This check can be overridden by appending the -.QT ! +@QT{!} character to the command name. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Tagnext , +@CO{Tagnext}, while in -.CO vi +@CO{vi} mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the line indicated by the tag. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY tagpop -.IP "tagp[op][!] [file | number]" +@end table +@end deftypefn +@cindex tagpop +@deftypefn Command {} {tagp[op][!]} {[file | number]} + Pop to the specified tag in the tags stack. If neither -.LI file -or -.LI number -is specified, the -.CO tagpop +@LI{file}or +@LI{number}is specified, the +@CO{tagpop} command pops to the most recent entry on the tags stack. If -.LI file -or -.LI number -is specified, the -.CO tagpop +@LI{file}or +@LI{number}is specified, the +@CO{tagpop} command pops to the most recent entry in the tags stack for that file, or numbered entry in the tags stack, respectively. (See the -.CO display +@CO{display} command for information on displaying the tags stack.) -.sp +@sp 1 If the file has been modified since the last complete write, the -.CO tagpop +@CO{tagpop} command will fail. This check may be overridden by appending a -.QT ! +@QT{!} character to the command name. -.SS -.SP Line: +@table @asis +@item Line: Set to the line indicated by the tag. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY tagprev -.IP "tagp[rev][!]" +@end table +@end deftypefn +@cindex tagprev +@deftypefn Command {} {tagp[rev][!]} + Edit the file containing the previous context for the current tag. If the context is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the -.CO tagprev +@CO{tagprev} command will fail. This check can be overridden by appending the -.QT ! +@QT{!} character to the command name. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Tagprev , +@CO{Tagprev}, while in -.CO vi +@CO{vi} mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the line indicated by the tag. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY tagtop -.IP "tagt[op][!]" +@end table +@end deftypefn +@cindex tagtop +@deftypefn Command {} {tagt[op][!]} + Pop to the least recent tag on the tags stack, clearing the tags stack. -.sp +@sp 1 If the file has been modified since the last complete write, the -.CO tagtop +@CO{tagtop} command will fail. This check may be overridden by appending a -.QT ! +@QT{!} character to the command name. -.SS -.SP Line: +@table @asis +@item Line: Set to the line indicated by the tag. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} and -.OP writeany +@OP{writeany} options. -.SE -.KY unabbrev -.IP "una[bbrev] lhs" +@end table +@end deftypefn +@cindex unabbrev +@deftypefn Command {} {una[bbrev]} {lhs} + Delete an abbreviation. Delete -.LI lhs -from the current list of abbreviations. -.SS -.SP Line: +@LI{lhs}from the current list of abbreviations. +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY undo -.IP "u[ndo]" +@end table +@end deftypefn +@cindex undo +@deftypefn Command {} {u[ndo]} + Undo the last change made to the file. Changes made by -.CO global , -.CO v , -.CO visual +@CO{global}, +@CO{v}, +@CO{visual} and map sequences are considered a single command. If repeated, the -.CO u +@CO{u} command alternates between these two states, and is its own inverse. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line modified by the command. -.SP Options: +@item Options: None. -.SE -.KY unmap -.IP "unm[ap][!] lhs" +@end table +@end deftypefn +@cindex unmap +@deftypefn Command {} {unm[ap][!]} {lhs} + Unmap a mapped string. Delete the command mode map definition for -.LI lhs . +@LI{lhs}. If a -.QT ! +@QT{!} character is appended to the command name, delete the text input mode map definition instead. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY version -.IP "ve[rsion]" +@end table +@end deftypefn +@cindex version +@deftypefn Command {} {ve[rsion]} + Display the version of the -.CO ex/vi +@CO{ex/vi} editor. -.KY visual -.IP "[line] vi[sual] [type] [count] [flags]" -.CO Ex +@end deftypefn +@cindex visual +@deftypefn Command {[line]} {vi[sual]} {[type] [count] [flags]} + +@CO{Ex} mode only. Enter -.CO vi . +@CO{vi}. The -.LI type -is optional, and can be -.QT \- , -.QT + +@LI{type}is optional, and can be +@QT{-}, +@QT{+} or -.QT ^ , +@QT{^}, as in the -.CO ex -.CO z +@CO{ex} +@CO{z} command, to specify the position of the specified line in the screen window. (The default is to place the line at the top of the screen window.) A -.LI count -specifies the number of lines that will initially be displayed. +@LI{count}specifies the number of lines that will initially be displayed. (The default is the value of the -.OP window +@OP{window} editor option.) -.SS -.SP Line: +@table @asis +@item Line: Unchanged unless -.LI line -is specified, in which case it is set to that line. -.SP Options: +@LI{line}is specified, in which case it is set to that line. +@item Options: None. -.SE -.KY visual -.IP "vi[sual][!] [+cmd] [file]" -.CO Vi +@end table +@end deftypefn +@cindex visual +@deftypefn Command {} {vi[sual][!]} {[+cmd] [file]} + +@CO{Vi} mode only. Edit a new file. Identical to the -.QT "edit[!] [+cmd] [file]" +@QT{edit[!] [+cmd] [file]} command. -.sp +@sp 1 Capitalizing the first letter of the command, i.e. -.CO Visual , +@CO{Visual}, will edit the file in a new screen. In this case, any modifications to the current file are ignored. -.KY viusage -.IP "viu[sage] [command]" +@end deftypefn +@cindex viusage +@deftypefn Command {} {viu[sage]} {[command]} + Display usage for a -.CO vi +@CO{vi} command. If -.LI command -is specified, a usage statement for that command is displayed. +@LI{command}is specified, a usage statement for that command is displayed. Otherwise, usage statements for all -.CO vi +@CO{vi} commands are displayed. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY write -.IP "[range] w[rite][!] [>>] [file]" -.Ip "[range] w[rite] [!] [file]" -.KY wn -.Ip "[range] wn[!] [>>] [file]" -.KY wq -.Ip "[range] wq[!] [>>] [file]" +@end table +@end deftypefn +@cindex write +@deftypefn Command {[range]} {w[rite][!]} {[>>] [file]} + +@deftypefnx Command {[range]} {w[rite]} {[!] [file]} +@cindex wn +@deftypefnx Command {[range]} {wn[!]} {[>>] [file]} +@cindex wq +@deftypefnx Command {[range]} {wq[!]} {[>>] [file]} Write the file. The specified lines (the entire file, if no range is given) is written to -.LI file . +@LI{file}. If -.LI file -is not specified, the current pathname is used. +@LI{file}is not specified, the current pathname is used. If -.LI file -is specified, and it exists, or if the current pathname was set using the -.CO file +@LI{file}is specified, and it exists, or if the current pathname was set using the +@CO{file} command, and the file already exists, these commands will fail. Appending a -.QT ! +@QT{!} character to the command name will override this check and the write will be attempted, regardless. -.sp +@sp 1 Specifying the optional -.QT >> +@QT{>>} string will cause the write to be appended to the file, in which case no tests are made for the file already existing. -.sp +@sp 1 If the file is preceded by a -.QT ! +@QT{!} character, the program named by the shell edit option is invoked with file as its second argument, and the specified lines are passed as standard input to that command. The -.QT ! +@QT{!} in this usage must be separated from command name by at least one whitespace character. The special meaning of the -.QT ! +@QT{!} may be overridden by escaping it with a backslash -.PQ \e +@PQ{\e} character. -.sp +@sp 1 The -.CO wq +@CO{wq} version of the write command will exit the editor after writing the file, if there are no further files to edit. Appending a -.QT ! +@QT{!} character to the command name or entering two -.QQ quit +@QQ{quit} commands (i.e. -.CO wq , -.CO quit , -.CO xit +@CO{wq}, +@CO{quit}, +@CO{xit} or -.CO ZZ ) +@CO{ZZ}) in a row) will override this check and the editor will exit, ignoring any files that have not yet been edited. -.sp +@sp 1 The -.CO wn +@CO{wn} version of the write command will move to the next file after writing the file, unless the write fails. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP readonly +@OP{readonly} and -.OP writeany +@OP{writeany} options. -.SE -.KY xit -.IP "[range] x[it][!] [file]" +@end table +@end deftypefn +@cindex xit +@deftypefn Command {[range]} {x[it][!]} {[file]} + Write the file if it has been modified. The specified lines are written to -.LI file , +@LI{file}, if the file has been modified since the last complete write to any file. If no -.LI range -is specified, the entire file is written. -.sp +@LI{range}is specified, the entire file is written. +@sp 1 The -.CO xit +@CO{xit} command will exit the editor after writing the file, if there are no further files to edit. Appending a -.QT ! +@QT{!} character to the command name or entering two -.QQ quit +@QQ{quit} commands (i.e. -.CO wq , -.CO quit , -.CO xit +@CO{wq}, +@CO{quit}, +@CO{xit} or -.CO ZZ ) +@CO{ZZ}) in a row) will override this check and the editor will exit, ignoring any files that have not yet been edited. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: Affected by the -.OP readonly +@OP{readonly} and -.OP writeany +@OP{writeany} options. -.SE -.KY yank -.IP "[range] ya[nk] [buffer] [count]" +@end table +@end deftypefn +@cindex yank +@deftypefn Command {[range]} {ya[nk]} {[buffer] [count]} + Copy the specified lines to a buffer. If no buffer is specified, the unnamed buffer is used. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY z -.IP "[line] z [type] [count] [flags]" +@end table +@end deftypefn +@cindex z +@deftypefn Command {[line]} {z} {[type] [count] [flags]} + Adjust the window. If no -.LI type -is specified, then -.LI count -lines following the specified line are displayed. +@LI{type}is specified, then +@LI{count}lines following the specified line are displayed. The default -.LI count -is the value of the -.OP window +@LI{count}is the value of the +@OP{window} option. The -.LI type -argument changes the position at which -.LI line -is displayed on the screen by changing the number of lines +@LI{type}argument changes the position at which +@LI{line}is displayed on the screen by changing the number of lines displayed before and after -.LI line . +@LI{line}. The following -.LI type -characters may be used: -.SS -.SP \- +@LI{type}characters may be used: +@table @asis +@item - Place the line at the bottom of the screen. -.SP + +@item + Place the line at the top of the screen. -.SP \&. +@item . Place the line in the middle of the screen. -.SP ^ +@item ^ Write out count lines starting -.LI "count * 2" -lines before -.LI line ; +@LI{count * 2}lines before +@LI{line}; the net effect of this is that a -.QT z^ +@QT{z^} command following a -.CO z +@CO{z} command writes the previous page. -.SP = +@item = Center -.LI line -on the screen with a line of hyphens displayed immediately before and +@LI{line}on the screen with a line of hyphens displayed immediately before and after it. The number of preceding and following lines of text displayed are reduced to account for those lines. -.SE -.SS -.SP Line: +@end table +@table @asis +@item Line: Set to the last line displayed, with the exception of the -.QT \&= -.LI type , +@QT{=} +@LI{type}, where the current line is set to the line specified by the command. -.SP Options: +@item Options: Affected by the -.OP scroll +@OP{scroll} option. -.SE +@end table +@end deftypefn diff --git a/docs/vi.ref/merge.awk b/docs/vi.ref/merge.awk deleted file mode 100644 index 95f91850..00000000 --- a/docs/vi.ref/merge.awk +++ /dev/null @@ -1,16 +0,0 @@ -# $Id: merge.awk,v 8.3 1994/05/25 23:45:36 bostic Exp $ (Berkeley) $Date: 1994/05/25 23:45:36 $ -# -# merge index entries into one line per label -$1 == prev { - printf ", %s", $2; - next; -} -{ - if (NR != 1) - printf "\n"; - printf "%s \t%s", $1, $2; - prev = $1; -} -END { - printf "\n" -} diff --git a/docs/vi.ref/ref.so b/docs/vi.ref/ref.so deleted file mode 100644 index a0a1289a..00000000 --- a/docs/vi.ref/ref.so +++ /dev/null @@ -1,103 +0,0 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 1994, 1995, 1996 -.\" Keith Bostic. All rights reserved. -.\" -.\" See the LICENSE file for redistribution information. -.\" -.\" $Id: ref.so,v 8.9 1996/08/17 17:47:02 bostic Exp $ (Berkeley) $Date: 1996/08/17 17:47:02 $ -.\" -.\" -.\" indented paragraph, with spaces between the items, bold font -.de IP -.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3 -.sp 1 -.nr PS \\n(ps -.nr ps 0 -.ip "\fB\\$1\fP" \\$2 -.nr ps \\n(PS -.br -.. -.\" indented paragraph, no spaces between the items, bold font -.de Ip -.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3 -.nr PS \\n(ps -.nr ps 0 -.ns -.ip "\fB\\$1\fP" \\$2 -.nr ps \\n(PS -.br -.. -.\" start nested .IP -.de SS -.sp -.ba +5n -.. -.\" end nested .IP -.de SE -.ba -5n -.. -.\" nested .IP, no spaces, normal font -.de SP -.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3 -.nr PS \\n(ps -.nr ps 0 -.ns -.ip "\\$1" 9n -.nr ps \\n(PS -.. -.\" typewriter font -.de LI -\&\fC\\$1\fP\\$2 -.. -.\" ex/vi names in command font -.de EV -\&\fB\\$1\fP/\fB\\$2\fP\\$3 -.. -.\" command names -.de CO -\&\fB\\$1\fP\\$2 -.. -.\" key words for index -.de KY -.sy echo >>index '\\$1 \\n%' -.. -.\" option names -.de OP -\&\fB\\$1\fP\\$2 -.. -.\" paren quoted (typewriter font) -.de PQ -(\*(lq\fC\\$1\fP\*(rq)\\$2 -.. -.\" quoted bold -.de QB -\*(lq\fB\\$1\fP\*(rq\\$2 -.. -.\" quoted command -.de QC -\*(lq\fB\\$1\fP\*(rq\\$2 -.. -.\" quoted option -.de QO -\*(lq\fB\\$1\fP\*(rq\\$2 -.. -.\" quoted (no font change) -.de QQ -\*(lq\\$1\*(rq\\$2 -.. -.\" quoted (typewriter font) -.de QT -\*(lq\fC\\$1\fP\*(rq\\$2 -.. -.\" section macro to build TOC -.de SH -.(x -\\$2 -.)x -.sh \\$1 "\\$2" -.. -.\" manual section -.de XR -\&\fI\\$1\fP(\\$2)\\$3 -.. diff --git a/docs/vi.ref/ref.texi b/docs/vi.ref/ref.texi new file mode 100644 index 00000000..8bde1ea2 --- /dev/null +++ b/docs/vi.ref/ref.texi @@ -0,0 +1,64 @@ +@comment Copyright (c) 1994 +@comment The Regents of the University of California. All rights reserved. +@comment Copyright (c) 1994, 1995, 1996 +@comment Keith Bostic. All rights reserved. +@comment +@comment See the LICENSE file for redistribution information. +@comment +@comment $Id: ref.texi,v 8.1 2001/08/18 20:43:48 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:48 $ +@comment +@comment +@comment indented paragraph, with spaces between the items, bold font +@macro IP{item} +@item @strong{\item\} +@comment @deffn {Command} {\item\} +@comment @end deffn +@end macro +@comment indented paragraph, no spaces between the items, bold font +@comment .de Ip +@comment .tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3 +@macro Ip{item} +@itemx @strong{\item\} +@end macro +@comment typewriter font +@macro LI{command} +@code{\command\} +@end macro +@comment ex/vi names in command font +@macro EV{ex,vi} +@strong{\ex\}/@strong{\vi\} +@end macro +@comment command names +@macro CO{command} +@strong{\command\} +@end macro +@comment option names +@macro OP{option} +@code{\option\} +@end macro +@comment paren quoted (typewriter font) +@macro PQ{command} +``@code{\command\}'' +@end macro +@comment quoted bold +@macro QB{command} +``@strong{\command\}'' +@end macro +@comment quoted command +@macro QC{command} +``@strong{\command\}'' +@end macro +@comment quoted option +@comment quoted (no font change) +@macro QQ{command} +``\command\'' +@end macro +@comment quoted (typewriter font) +@macro QT{command} +``@code{\command\}'' +@end macro +@comment section macro to build TOC +@comment manual section +@macro XR{command,section} +@command{\command\}(\section\) +@end macro diff --git a/docs/vi.ref/set.opt.roff b/docs/vi.ref/set.opt.texi similarity index 69% rename from docs/vi.ref/set.opt.roff rename to docs/vi.ref/set.opt.texi index f754c386..a64847a9 100644 --- a/docs/vi.ref/set.opt.roff +++ b/docs/vi.ref/set.opt.texi @@ -1,64 +1,66 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 1994, 1995, 1996 -.\" Keith Bostic. All rights reserved. -.\" -.\" See the LICENSE file for redistribution information. -.\" -.\" $Id: set.opt.roff,v 8.66 1996/10/10 21:38:25 bostic Exp $ (Berkeley) $Date: 1996/10/10 21:38:25 $ -.\" -.SH 1 "Set Options" -.pp +@comment Copyright (c) 1994 +@comment The Regents of the University of California. All rights reserved. +@comment Copyright (c) 1994, 1995, 1996 +@comment Keith Bostic. All rights reserved. +@comment +@comment See the LICENSE file for redistribution information. +@comment +@comment $Id: set.opt.texi,v 8.1 2001/08/18 20:43:48 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:48 $ +@comment +@chapter Set Options + There are a large number of options that may be set (or unset) to change the editor's behavior. This section describes the options, their abbreviations and their default values. -.pp + In each entry below, the first part of the tag line is the full name of the option, followed by any equivalent abbreviations. (Regardless of the abbreviations, it is only necessary to use the minimum number of characters necessary to distinguish an abbreviation from all other commands for it to be accepted, in -.EV nex nvi . +@EV{nex,nvi}. Historically, only the full name and the official abbreviations were accepted by -.EV ex vi . +@EV{ex,vi}. Using full names in your startup files and environmental variables will probably make them more portable.) The part in square brackets is the default value of the option. Most of the options are boolean, i.e. they are either on or off, and do not have an associated value. -.pp + Options apply to both -.CO ex +@CO{ex} and -.CO vi +@CO{vi} modes, unless otherwise specified. -.pp + With a few exceptions, all options are settable per screen, i.e. the -.OP tags +@OP{tags} option can be set differently in each screen. The exceptions are the -.OP columns , -.OP lines , -.OP secure +@OP{columns}, +@OP{lines}, +@OP{secure} and -.OP term +@OP{term} options. Changing these options modifies the respective information for all screens. -.pp + For information on modifying the options or to display the options and their current values, see the -.QQ set +@QQ{set} command in the section entitled -.QB "Ex Commands" . -.KY altwerase -.IP "altwerase [off]" -.CO Vi +@QB{Ex Commands} . +@itemize @bullet +@cindex altwerase +@IP{altwerase [off]} + +@CO{Vi} only. Change how -.CO vi +@CO{vi} does word erase during text input. When this option is set, text is broken up into three classes: alphabetic, numeric and underscore characters, other nonblank @@ -66,364 +68,366 @@ characters, and blank characters. Changing from one class to another marks the end of a word. In addition, the class of the first character erased is ignored (which is exactly what you want when erasing pathname components). -.KY autoindent -.IP "autoindent, ai [off]" +@cindex autoindent +@IP{autoindent, ai [off]} + If this option is set, whenever you create a new line (using the -.CO vi -.CO A , -.CO a , -.CO C , -.CO c , -.CO I , -.CO i , -.CO O , -.CO o , -.CO R , -.CO r , -.CO S , +@CO{vi} +@CO{A}, +@CO{a}, +@CO{C}, +@CO{c}, +@CO{I}, +@CO{i}, +@CO{O}, +@CO{o}, +@CO{R}, +@CO{r}, +@CO{S}, and -.CO s +@CO{s} commands, or the -.CO ex -.CO append , -.CO change , +@CO{ex} +@CO{append}, +@CO{change}, and -.CO insert +@CO{insert} commands) the new line is automatically indented to align the cursor with the first nonblank character of the line from which you created it. Lines are indented using tab characters to the extent possible (based on the value of the -.OP tabstop +@OP{tabstop} option) and then using space characters as necessary. For commands inserting text into the middle of a line, any blank characters to the right of the cursor are discarded, and the first nonblank character to the right of the cursor is aligned as described above. -.sp +@sp 1 The indent characters are themselves somewhat special. If you do not enter more characters on the new line before moving to another line, or entering -.LI , +@LI{}, the indent character will be deleted and the line will be empty. For example, if you enter -.LI -twice in succession, +@LI{}twice in succession, the line created by the first -.LI -will not have any characters in it, +@LI{}will not have any characters in it, regardless of the indentation of the previous or subsequent line. -.sp +@sp 1 Indent characters also require that you enter additional erase characters to delete them. For example, if you have an indented line, containing only blanks, the first -.LI -character you enter will erase up to end of the indent characters, +@LI{}character you enter will erase up to end of the indent characters, and the second will erase back to the beginning of the line. (Historically, only the -.LI -key would erase the indent characters. +@LI{}key would erase the indent characters. Both the -.LI -key and the usual erase keys work in -.CO nvi .) +@LI{}key and the usual erase keys work in +@CO{nvi}.) In addition, if the cursor is positioned at the end of the indent characters, the keys -.QT 0 +@QT{0} will erase all of the indent characters for the current line, resetting the indentation level to 0. Similarly, the keys -.QT ^ +@QT{^} will erase all of the indent characters for the current line, leaving the indentation level for future created lines unaffected. -.sp +@sp 1 Finally, if the -.OP autoindent +@OP{autoindent} option is set, the -.CO S +@CO{S} and -.CO cc +@CO{cc} commands change from the first nonblank of the line to the end of the line, instead of from the beginning of the line to the end of the line. -.KY autoprint -.IP "autoprint, ap [off]" -.CO Ex +@cindex autoprint +@IP{autoprint, ap [off]} + +@CO{Ex} only. Cause the current line to be automatically displayed after the -.CO ex +@CO{ex} commands -.CO < , -.CO > , -.CO copy , -.CO delete , -.CO join , -.CO move , -.CO put , -.CO t , -.CO Undo , +@CO{<}, +@CO{>}, +@CO{copy}, +@CO{delete}, +@CO{join}, +@CO{move}, +@CO{put}, +@CO{t}, +@CO{Undo}, and -.CO undo . +@CO{undo}. This automatic display is suppressed during -.CO global +@CO{global} and -.CO v +@CO{v} commands, and for any command where optional flags are used to explicitly display the line. -.KY autowrite -.IP "autowrite, aw [off]" +@cindex autowrite +@IP{autowrite, aw [off]} + If this option is set, the -.CO vi -.CO ! , -.CO ^^ , -.CO ^] +@CO{vi} +@CO{!}, +@CO{^^}, +@CO{^]} and -.CO +@CO{} commands, and the -.CO ex -.CO edit , -.CO next , -.CO rewind , -.CO stop , -.CO suspend , -.CO tag , -.CO tagpop , +@CO{ex} +@CO{edit}, +@CO{next}, +@CO{rewind}, +@CO{stop}, +@CO{suspend}, +@CO{tag}, +@CO{tagpop}, and -.CO tagtop +@CO{tagtop} commands automatically write the current file back to the current file name if it has been modified since it was last written. If the write fails, the command fails and goes no further. -.sp +@sp 1 Appending the optional force flag character -.QT ! +@QT{!} to the -.CO ex +@CO{ex} commands -.CO next , -.CO rewind , -.CO stop , -.CO suspend , -.CO tag , -.CO tagpop , +@CO{next}, +@CO{rewind}, +@CO{stop}, +@CO{suspend}, +@CO{tag}, +@CO{tagpop}, and -.CO tagtop +@CO{tagtop} stops the automatic write from being attempted. -.sp +@sp 1 (Historically, the -.CO next +@CO{next} command ignored the optional force flag.) Note, the -.CO ex +@CO{ex} commands -.CO edit , -.CO quit , -.CO shell , +@CO{edit}, +@CO{quit}, +@CO{shell}, and -.CO xit +@CO{xit} are -.i not +@emph{not} affected by the -.OP autowrite +@OP{autowrite} option. -.sp +@sp 1 The -.OP autowrite +@OP{autowrite} option is ignored if the file is considered read-only for any reason. -.\" I cannot get a double quote to print between the square brackets -.\" to save my life. The ONLY way I've been able to get this to work -.\" is with the .tr command. -.tr Q" -.ds ms backup [QQ] -.KY backup -.IP "\*(ms" -.tr QQ +@comment I cannot get a double quote to print between the square brackets +@comment to save my life. The ONLY way I've been able to get this to work +@comment is with the .tr command. +@cindex backup +@IP{backup [""]} + If this option is set, it specifies a pathname used as a backup file, and, whenever a file is written, the file's current contents are copied to it. The pathname is -.QT \&# , -.QT \&% +@QT{#}, +@QT{%} and -.QT \&! +@QT{!} expanded. -.sp +@sp 1 If the first character of the pathname is -.QT \&N , +@QT{N}, a version number is appended to the pathname (and the -.QT \&N +@QT{N} character is then discarded). Version numbers are always incremented, and each backup file will have a version number one greater than the highest version number currently found in the directory. -.sp +@sp 1 Backup files must be regular files, owned by the real user ID of the user running the editor, and not accessible by any other user. -.KY beautify -.IP "beautify, bf [off]" +@cindex beautify +@IP{beautify, bf [off]} + If this option is set, all control characters that are not currently being specially interpreted, other than -.LI , -.LI , +@LI{}, +@LI{}, and -.LI , +@LI{}, are discarded from commands read in by -.CO ex +@CO{ex} from command files, and from input text entered to -.CO vi +@CO{vi} (either into the file or to the colon command line). Text files read by -.EV ex vi +@EV{ex,vi} are -.i not +@emph{not} affected by the -.OP beautify +@OP{beautify} option. -.KY cdpath -.IP "cdpath [environment variable CDPATH, or current directory]" +@cindex cdpath +@IP{cdpath [environment variable CDPATH, or current directory]} + This option is used to specify a colon separated list of directories which are used as path prefixes for any relative path names used as arguments for the -.CO cd +@CO{cd} command. The value of this option defaults to the value of the environmental variable -.LI CDPATH -if it is set, otherwise to the current directory. +@LI{CDPATH}if it is set, otherwise to the current directory. For compatibility with the POSIX 1003.2 shell, the -.CO cd +@CO{cd} command does -.i not +@emph{not} check the current directory as a path prefix for relative path names unless it is explicitly specified. It may be so specified by entering an empty string or a -.QT \&. +@QT{.} character into the -.LI CDPATH -variable or the option value. -.KY cedit -.IP "cedit [no default]" +@LI{CDPATH}variable or the option value. +@cindex cedit +@IP{cedit [no default]} + This option adds the ability to edit the colon command-line history. This option is set to a string. Whenever the first character of that string is entered on the colon command line, you will enter a normal editing window on the collected commands that you've entered on the -.CO vi +@CO{vi} colon command-line. You may then modify and/or execute the commands. All normal text editing is available, except that you cannot use -.CO +@CO{} to switch to an alternate screen. Entering a -.CO +@CO{} will execute the current line of the screen window as an ex command in the context of the screen from which you created the colon command-line screen, and you will then return to that screen. -.sp +@sp 1 Because of -.CO vi \&'s +@CO{vi}'s parsing rules, it can be difficult to set the colon command-line edit character to the -.LI -character. +@LI{}character. To set it to -.LI , +@LI{}, use -.QT "set cedit=" . -.sp +@QT{set cedit=}. +@sp 1 If the -.OP cedit +@OP{cedit} edit option is set to the same character as the -.OP filec +@OP{filec} edit option, -.CO vi +@CO{vi} will perform colon command-line editing if the character is entered as the first character of the line, otherwise, -.CO vi +@CO{vi} will perform file name expansion. -.KY columns -.IP "columns, co [80]" +@cindex columns +@IP{columns, co [80]} + The number of columns in the screen. Setting this option causes -.EV ex vi +@EV{ex,vi} to set (or reset) the environmental variable -.LI COLUMNS . +@LI{COLUMNS}. See the section entitled -.QB "Sizing the Screen" +@QB{Sizing the Screen} more information. -.KY comment -.IP "comment [off]" -.CO Vi +@cindex comment +@IP{comment [off]} + +@CO{Vi} only. If the first non-empty line of the file begins with the string -.QT # , -.QT /\&* +@QT{#}, +@QT{/*} or -.QT // , +@QT{//}, this option causes -.CO vi +@CO{vi} to skip to the end of that shell, C or C++ comment (probably a terribly boring legal notice) before displaying the file. -.KY directory -.IP "directory, dir [environment variable TMPDIR, or /tmp]" +@cindex directory +@IP{directory, dir [environment variable TMPDIR, or /tmp]} + The directory where temporary files are created. The environmental variable -.LI TMPDIR -is used as the default value if it exists, otherwise -.LI /tmp -is used. -.KY edcompatible -.IP "edcompatible, ed [off]" +@LI{TMPDIR}is used as the default value if it exists, otherwise +@LI{/tmp}is used. +@cindex edcompatible +@IP{edcompatible, ed [off]} + Remember the values of the -.QQ c +@QQ{c} and -.QQ g +@QQ{g} suffixes to the -.CO substitute +@CO{substitute} commands, instead of initializing them as unset for each new command. Specifying pattern and replacement strings to the -.CO substitute +@CO{substitute} command unsets the -.QQ c +@QQ{c} and -.QQ g +@QQ{g} suffixes as well. -.KY escapetime -.IP "escapetime [1]" +@cindex escapetime +@IP{escapetime [1]} + The 10th's of a second -.EV ex vi +@EV{ex,vi} waits for a subsequent key to complete an -.LI -key mapping. -.KY errorbells -.IP "errorbells, eb [off]" -.CO Ex +@LI{}key mapping. +@cindex errorbells +@IP{errorbells, eb [off]} + +@CO{Ex} only. -.CO Ex +@CO{Ex} error messages are normally presented in inverse video. If that is not possible for the terminal, setting this option causes error messages to be announced by ringing the terminal bell. -.KY exrc -.IP "exrc, ex [off]" +@cindex exrc +@IP{exrc, ex [off]} + If this option is turned on in the EXINIT environment variables, or the system or $HOME startup files, the local startup files are read, unless they are the same as the system or $HOME startup files or fail to pass the standard permission checks. See the section entitled -.QB "Startup Information" +@QB{Startup Information} for more information. -.KY extended -.IP "extended [off]" +@cindex extended +@IP{extended [off]} + This option causes all regular expressions to be treated as POSIX 1003.2 Extended Regular Expressions (which are similar to historic -.XR egrep 1 +@XR{egrep,1} style expressions). -.KY filec -.IP "filec [no default]" +@cindex filec +@IP{filec [no default]} + This option adds the ability to do shell expansion when entering input on the colon command line. This option is set to a string. @@ -431,774 +435,812 @@ Whenever the first character of that string is entered on the colon command line, the delimited string immediately before the cursor is expanded as if it were followed by a -.LI \&* -character, and file name expansion for the -.CO ex +@LI{*}character, and file name expansion for the +@CO{ex} edit command was done. If no match is found, the screen is flashed and text input resumed. If a single match results, that match replaces the expanded text. In addition, if the single match is for a directory, a -.LI \&/ -character is appended and file completion is repeated. +@LI{/}character is appended and file completion is repeated. If more than a single match results, any unique prefix shared by the matches replaces the expanded text, the matches are displayed, and text input resumed. -.sp +@sp 1 Because of -.CO vi \&'s +@CO{vi}'s parsing rules, it can be difficult to set the path completion character to two command values, -.LI -and -.LI . +@LI{}and +@LI{}. To set it to -.LI , +@LI{}, use -.QT "set filec=" . +@QT{set filec=}. To set it to -.LI , +@LI{}, use -.QT "set filec=\e" . -.sp +@QT{set filec=\e}. +@sp 1 If the -.OP cedit +@OP{cedit} edit option is set to the same character as the -.OP filec +@OP{filec} edit option, -.CO vi +@CO{vi} will perform colon command-line editing if the character is entered as the first character of the line, otherwise, -.CO vi +@CO{vi} will perform file name expansion. -.KY flash -.IP "flash [on]" +@cindex flash +@IP{flash [on]} + This option causes the screen to flash instead of beeping the keyboard, on error, if the terminal has the capability. -.KY hardtabs -.IP "hardtabs, ht [8]" +@cindex hardtabs +@IP{hardtabs, ht [8]} + This option defines the spacing between hardware tab settings, i.e. the tab expansion done by the operating system and/or the terminal itself. As -.EV nex nvi +@EV{nex,nvi} never writes -.LI -characters to the terminal, unlike historic versions of -.EV ex vi , +@LI{}characters to the terminal, unlike historic versions of +@EV{ex,vi}, this option does not currently have any affect. -.KY iclower -.IP "iclower [off]" +@cindex iclower +@IP{iclower [off]} + The -.OP iclower +@OP{iclower} edit option makes all Regular Expressions case-insensitive, as long as an upper-case letter does not appear in the search string. -.KY ignorecase -.IP "ignorecase, ic [off]" +@cindex ignorecase +@IP{ignorecase, ic [off]} + This option causes regular expressions, both in -.CO ex +@CO{ex} commands and in searches, to be evaluated in a case-insensitive manner. -.KY keytime -.IP "keytime [6]" +@cindex keytime +@IP{keytime [6]} + The 10th's of a second -.EV ex vi +@EV{ex,vi} waits for a subsequent key to complete a key mapping. -.KY leftright -.IP "leftright [off]" -.CO Vi +@cindex leftright +@IP{leftright [off]} + +@CO{Vi} only. This option causes the screen to be scrolled left-right to view lines longer than the screen, instead of the traditional -.CO vi +@CO{vi} screen interface which folds long lines at the right-hand margin of the terminal. -.KY lines -.IP "lines, li [24]" -.CO Vi +@cindex lines +@IP{lines, li [24]} + +@CO{Vi} only. The number of lines in the screen. Setting this option causes -.EV ex vi +@EV{ex,vi} to set (or reset) the environmental variable -.LI LINES . +@LI{LINES}. See the section entitled -.QB "Sizing the Screen" +@QB{Sizing the Screen} for more information. -.KY lisp -.IP "lisp [off]" -.CO Vi +@cindex lisp +@IP{lisp [off]} + +@CO{Vi} only. This option changes the behavior of the -.CO vi -.CO ( , -.CO ) , -.CO { , -.CO } , -.CO [[ +@CO{vi} +@CO{(}, +@CO{)}, +@strong{@{}, +@strong{@}}, +@CO{[[} and -.CO ]] +@CO{]]} commands to match the Lisp language. Also, the -.OP autoindent +@OP{autoindent} option's behavior is changed to be appropriate for Lisp. -.sp -.i "This option is not yet implemented." -.KY list -.IP "list [off]" +@sp 1 +@emph{This option is not yet implemented.} +@cindex list +@IP{list [off]} + This option causes lines to be displayed in an unambiguous fashion. Specifically, tabs are displayed as control characters, i.e. -.QT ^I , +@QT{^I}, and the ends of lines are marked with a -.QT $ +@QT{$} character. -.KY lock -.IP "lock [on]" +@cindex lock +@IP{lock [on]} + This option causes the editor to attempt to get an exclusive lock on any file being edited, read or written. Reading or writing a file that cannot be locked produces a warning message, but no other effect. Editing a file that cannot be locked results in a read only edit session, as if the -.OP readonly +@OP{readonly} edit option were set. -.KY magic -.IP "magic [on]" +@cindex magic +@IP{magic [on]} + This option is on by default. Turning the -.OP magic +@OP{magic} option off causes all regular expression characters except for -.QT ^ +@QT{^} and -.QT $ , +@QT{$}, to be treated as ordinary characters. To re-enable characters individually, when the -.OP magic +@OP{magic} option is off, precede them with a backslash -.QT \e +@QT{\e} character. See the section entitled -.QB "Regular Expressions and Replacement Strings" +@QB{Regular Expressions and Replacement Strings} for more information. -.KY matchtime -.IP "matchtime [7]" -.CO Vi +@cindex matchtime +@IP{matchtime [7]} + +@CO{Vi} only. The 10th's of a second -.CO vi +@CO{vi} pauses on the matching character when the -.OP showmatch +@OP{showmatch} option is set. -.KY mesg -.IP "mesg [on]" +@cindex mesg +@IP{mesg [on]} + This option allows other users to contact you using the -.XR talk 1 +@XR{talk,1} and -.XR write 1 +@XR{write,1} utilities, while you are editing. -.EV Ex vi +@EV{Ex,vi} does not turn message on, i.e. if messages were turned off when the editor was invoked, they will stay turned off. This option only permits you to disallow messages for the edit session. See the -.XR mesg 1 +@XR{mesg,1} utility for more information. -.KY msgcat -.IP "msgcat [./]" +@cindex msgcat +@IP{msgcat [./]} + This option selects a message catalog to be used to display error and informational messages in a specified language. If the value of this option ends with a '/', it is treated as the name of a directory that contains a message catalog -.QT "vi_XXXX" , +@QT{vi_XXXX}, where -.QT XXXX +@QT{XXXX} is the value of the -.LI LANG -environmental variable, if it's set, or the value of the -.LI LC_MESSAGES -environmental variable if it's not. +@LI{LANG}environmental variable, if it's set, or the value of the +@LI{LC_MESSAGES}environmental variable if it's not. If neither of those environmental variables are set, or if the option doesn't end in a '/', the option is treated as the full path name of the message catalog to use. -.sp +@sp 1 If any messages are missing from the catalog, the backup text (English) is used instead. -.sp +@sp 1 See the distribution file -.LI catalog/README -for additional information on building and installing message catalogs. -.KY modelines -.IP "modelines, modeline [off]" +@LI{catalog/README}for additional information on building and installing message catalogs. +@cindex modelines +@IP{modelines, modeline [off]} + If the -.OP modelines +@OP{modelines} option is set, -.EV ex vi +@EV{ex,vi} has historically scanned the first and last five lines of each file as it is read for editing, looking for any -.CO ex +@CO{ex} commands that have been placed in those lines. After the startup information has been processed, and before the user starts editing the file, any commands embedded in the file are executed. -.sp +@sp 1 Commands were recognized by the letters -.QQ e +@QQ{e} or -.QQ v +@QQ{v} followed by -.QQ x +@QQ{x} or -.QQ i , +@QQ{i}, at the beginning of a line or following a tab or space character, and followed by a -.QQ : , +@QQ{:}, an -.CO ex +@CO{ex} command, and another -.QQ : . -.sp +@QQ{:}. +@sp 1 This option is a security problem of immense proportions, and should not be used under any circumstances. -.sp -.i "This option will never be implemented." -.\" I cannot get a double quote to print between the square brackets -.\" to save my life. The ONLY way I've been able to get this to work -.\" is with the .tr command. -.tr Q" -.ds ms noprint [QQ] -.KY noprint -.IP "\*(ms" -.tr QQ +@sp 1 +@emph{This option will never be implemented.} +@comment I cannot get a double quote to print between the square brackets +@comment to save my life. The ONLY way I've been able to get this to work +@comment is with the .tr command. +@cindex noprint +@IP{noprint [""]} + Characters that are never handled as printable characters. By default, the C library function -.XR isprint 3 +@XR{isprint,3} is used to determine if a character is printable or not. This edit option overrides that decision. -.KY number -.IP "number, nu [off]" +@cindex number +@IP{number, nu [off]} + Precede each line displayed with its current line number. -.KY octal -.IP "octal [off]" +@cindex octal +@IP{octal [off]} + Display unknown characters as octal numbers -.PQ "\e###" , +@PQ{"\e###"}, instead of the default hexadecimal -.PQ "\ex##" . -.KY open -.IP "open [on]" -.CO Ex +@PQ{"\ex##"}. +@cindex open +@IP{open [on]} + +@CO{Ex} only. If this option is not set, the -.CO open +@CO{open} and -.CO visual +@CO{visual} commands are disallowed. -.KY optimize -.IP "optimize, opt [on]" -.CO Vi +@cindex optimize +@IP{optimize, opt [on]} + +@CO{Vi} only. Throughput of text is expedited by setting the terminal not to do automatic carriage returns when printing more than one (logical) line of output, greatly speeding output on terminals without addressable cursors when text with leading white space is printed. -.sp -.i "This option is not yet implemented." -.KY paragraphs -.IP "paragraphs, para [IPLPPPQPP LIpplpipbp]" -.CO Vi +@sp 1 +@emph{This option is not yet implemented.} +@cindex paragraphs +@IP{paragraphs, para [IPLPPPQPP LIpplpipbp]} + +@CO{Vi} only. Define additional paragraph boundaries for the -.CO { +@CO{@{} and -.CO } +@strong{@}} commands. The value of this option must be a character string consisting of zero or more character pairs. -.sp +@sp 1 In the text to be edited, the character string -.LI "." , +@LI{.}, (where -.LI -is one of the character pairs in the option's value) +@LI{}is one of the character pairs in the option's value) defines a paragraph boundary. For example, if the option were set to -.LI "LaA##" , +@LI{LaA##}, then all of the following additional paragraph boundaries would be recognized: -.sp -.(l +@sp 1 +@example .La .A .## -.)l -.KY path -.IP "path []" +@end example +@cindex path +@IP{path []} + The path option can be used to specify a -separated list of paths, similar to the -.LI PATH -environment variable in the shells. +@LI{PATH}environment variable in the shells. If this option is set, the name of the file to be edited is not an absolute pathname, the first component of the filename is not -.QT \&. +@QT{.} or -.QT \&.. , +@QT{..}, and the file to be edited doesn't exist in the current directory, the elements of the -.OP path +@OP{path} option are sequentially searched for a file of the specified name. If such a file is found, it is edited. -.\" I cannot get a double quote to print between the square brackets -.\" to save my life. The ONLY way I've been able to get this to work -.\" is with the .tr command. -.tr Q" -.ds ms print [QQ] -.KY print -.IP "\*(ms" -.tr QQ +@comment I cannot get a double quote to print between the square brackets +@comment to save my life. The ONLY way I've been able to get this to work +@comment is with the .tr command. +@cindex print +@IP{print [""]} + Characters that are always handled as printable characters. By default, the C library function -.XR isprint 3 +@XR{isprint,3} is used to determine if a character is printable or not. This edit option overrides that decision. -.KY prompt -.IP "prompt [on]" -.CO Ex +@cindex prompt +@IP{prompt [on]} + +@CO{Ex} only. This option causes -.CO ex +@CO{ex} to prompt for command input with a -.QT : +@QT{:} character; when it is not set, no prompt is displayed. -.KY readonly -.IP "readonly, ro [off]" +@cindex readonly +@IP{readonly, ro [off]} + This option causes a force flag to be required to attempt to write the file. Setting this option is equivalent to using the -.b \-R +@strong{-R} command line option, or executing the -.CO vi +@CO{vi} program using the name -.CO view . -.sp +@CO{view}. +@sp 1 The -.OP readonly +@OP{readonly} edit option is not usually persistent, like other edit options. If the -.b \-R +@strong{-R} command line option is set, -.CO vi +@CO{vi} is executed as -.CO view , +@CO{view}, or the -.OP readonly +@OP{readonly} edit option is explicitly set, all files edited in the screen will be marked readonly, and the force flag will be required to write them. However, if none of these conditions are true, or the -.OP readonly +@OP{readonly} edit option is explicitly unset, then the -.OP readonly +@OP{readonly} edit option will toggle based on the write permissions of the file currently being edited as of when it is loaded into the edit buffer. In other words, the -.OP readonly +@OP{readonly} edit option will be set if the current file lacks write permissions, and will not be set if the user has write permissions for the file. -.KY recdir -.IP "recdir [/var/tmp/vi.recover]" +@cindex recdir +@IP{recdir [/var/tmp/vi.recover]} + The directory where recovery files are stored. -.sp +@sp 1 If you change the value of -.OP recdir , +@OP{recdir}, be careful to choose a directory whose contents are not regularly deleted. Bad choices include directories in memory based filesystems, or -.LI /tmp , +@LI{/tmp}, on most systems, as their contents are removed when the machine is rebooted. -.sp +@sp 1 Public directories like -.LI /usr/tmp -and -.LI /var/tmp -are usually safe, although some sites periodically prune old files +@LI{/usr/tmp}and +@LI{/var/tmp}are usually safe, although some sites periodically prune old files from them. There is no requirement that you use a public directory, e.g. a sub-directory of your home directory will work fine. -.sp +@sp 1 Finally, if you change the value of -.OP recdir , +@OP{recdir}, you must modify the recovery script to operate in your chosen recovery area. -.sp +@sp 1 See the section entitled -.QB "Recovery" +@QB{Recovery} for further information. -.KY redraw -.IP "redraw, re [off]" -.CO Vi +@cindex redraw +@IP{redraw, re [off]} + +@CO{Vi} only. The editor simulates (using great amounts of output), an intelligent terminal on a dumb terminal (e.g. during insertions in -.CO vi +@CO{vi} the characters to the right of the cursor are refreshed as each input character is typed). -.sp -.i "This option is not yet implemented." -.KY remap -.IP "remap [on]" +@sp 1 +@emph{This option is not yet implemented.} +@cindex remap +@IP{remap [on]} + If this option is set, it is possible to define macros in terms of other macros. Otherwise, each key is only remapped up to one time. For example, if -.QT A +@QT{A} is mapped to -.QT B , +@QT{B}, and -.QT B +@QT{B} is mapped to -.QT C , +@QT{C}, The keystroke -.QT A +@QT{A} will be mapped to -.QT C +@QT{C} if the -.OP remap +@OP{remap} option is set, and to -.QT B +@QT{B} if it is not set. -.KY report -.IP "report [5]" +@cindex report +@IP{report [5]} + Set the threshold of the number of lines that need to be changed or yanked before a message will be displayed to the user. For everything but the yank command, the value is the largest value about which the editor is silent, i.e. by default, 6 lines must be deleted before the user is notified. However, if the number of lines yanked is greater than -.i "or equal to" +@emph{or equal to} the set value, it is reported to the user. -.KY ruler -.IP "ruler [off]" -.CO Vi +@cindex ruler +@IP{ruler [off]} + +@CO{Vi} only. Display a row/column ruler on the colon command line. -.KY scroll -.IP "scroll, scr [(environment variable LINES - 1) / 2]" +@cindex scroll +@IP{scroll, scr [(environment variable LINES - 1) / 2]} + Set the number of lines scrolled by the -.CO ex -.CO +@CO{ex} +@CO{} and -.CO +@CO{} commands. -.sp +@sp 1 Historically, the -.CO ex -.CO z +@CO{ex} +@CO{z} command, when specified without a count, used two times the size of the scroll value; the POSIX 1003.2 standard specified the window size, which is a better choice. -.KY searchincr -.IP "searchincr [off]" +@cindex searchincr +@IP{searchincr [off]} + The -.OP searchincr +@OP{searchincr} edit option makes the search commands -.CO \&/ +@CO{/} and -.CO \&? +@CO{?} incremental, i.e. the screen is updated and the cursor moves to the matching text as the search pattern is entered. If the search pattern is not found, the screen is beeped and the cursor remains on the colon-command line. Erasing characters from the search pattern backs the cursor up to the previous matching text. -.KY sections -.IP "sections, sect [NHSHH HUnhsh]" -.CO Vi +@cindex sections +@IP{sections, sect [NHSHH HUnhsh]} + +@CO{Vi} only. Define additional section boundaries for the -.CO [[ +@CO{[[} and -.CO ]] +@CO{]]} commands. The -.OP sections +@OP{sections} option should be set to a character string consisting of zero or more character pairs. In the text to be edited, the character string -.LI "." , +@LI{.}, (where -.LI -is one of the character pairs in the option's value), +@LI{}is one of the character pairs in the option's value), defines a section boundary in the same manner that -.OP paragraphs +@OP{paragraphs} option boundaries are defined. -.KY secure -.IP "secure [off]" +@cindex secure +@IP{secure [off]} + The -.OP secure +@OP{secure} edit option turns off all access to external programs. This means that the versions of the -.CO read +@CO{read} and -.CO write +@CO{write} commands that filter text through other programs, the -.CO vi -.CO \&! +@CO{vi} +@CO{!} and -.CO +@CO{} commands, the -.CO ex -.CO \&! , -.CO script , -.CO shell , -.CO stop +@CO{ex} +@CO{!}, +@CO{script}, +@CO{shell}, +@CO{stop} and -.CO suspend +@CO{suspend} commands and file name expansion will not be permitted. Once set, the -.OP secure +@OP{secure} edit option may not be unset. -.KY shell -.IP "shell, sh [environment variable SHELL, or /bin/sh]" +@cindex shell +@IP{shell, sh [environment variable SHELL, or /bin/sh]} + Select the shell used by the editor. The specified path is the pathname of the shell invoked by the -.CO vi -.CO ! +@CO{vi} +@CO{!} shell escape command and by the -.CO ex -.CO shell +@CO{ex} +@CO{shell} command. This program is also used to resolve any shell meta-characters in -.CO ex +@CO{ex} commands. -.\" I cannot get a double quote to print between the square brackets -.\" to save my life. The ONLY way I've been able to get this to work -.\" is with the .tr command. -.tr Q" -.ds ms shellmeta [~{[*?$`'Q\e] -.KY shellmeta -.IP "\*(ms" -.tr QQ +@comment I cannot get a double quote to print between the square brackets +@comment to save my life. The ONLY way I've been able to get this to work +@comment is with the .tr command. +@cindex shellmeta +@comment @IP{shellmeta [~@{[*?@$`'"\e]} +@item @strong{shellmeta [~@{[*?$`'"\]} + The set of characters that -.CO ex +@CO{ex} checks for when doing file name expansion. If any of the specified characters are found in the file name arguments to the -.CO ex +@CO{ex} commands, the arguments are expanded using the program defined by the -.OP shell +@OP{shell} option. The default set of characters is a union of meta characters from the Version 7 and the Berkeley C shell. -.KY shiftwidth -.IP "shiftwidth, sw [8]" +@cindex shiftwidth +@IP{shiftwidth, sw [8]} + Set the autoindent and shift command indentation width. This width is used by the -.OP autoindent +@OP{autoindent} option and by the -.CO < , -.CO > , +@CO{<}, +@CO{>}, and -.CO shift +@CO{shift} commands. -.KY showmatch -.IP "showmatch, sm [off]" -.CO Vi +@cindex showmatch +@IP{showmatch, sm [off]} + +@CO{Vi} only. This option causes -.CO vi , +@CO{vi}, when a -.QT } +@comment QT +``@code{@}}'' or -.QT ) +@QT{)} is entered, to briefly move the cursor the matching -.QT { +@comment QT +``@code{@{}'' or -.QT ( . +@QT{(}. See the -.OP matchtime +@OP{matchtime} option for more information. -.KY showmode -.IP "showmode, smd [off]" -.CO Vi +@cindex showmode +@IP{showmode, smd [off]} + +@CO{Vi} only. This option causes -.CO vi +@CO{vi} to display a string identifying the current editor mode on the colon command line. The string is preceded by an asterisk (``*'') if the file has been modified since it was last completely written, -.KY sidescroll -.IP "sidescroll [16]" -.CO Vi +@cindex sidescroll +@IP{sidescroll [16]} + +@CO{Vi} only. Sets the number of columns that are shifted to the left or right, when -.CO vi +@CO{vi} is doing left-right scrolling and the left or right margin is crossed. See the -.OP leftright +@OP{leftright} option for more information. -.KY slowopen -.IP "slowopen, slow [off]" +@cindex slowopen +@IP{slowopen, slow [off]} + This option affects the display algorithm used by -.CO vi , +@CO{vi}, holding off display updating during input of new text to improve throughput when the terminal in use is slow and unintelligent. -.sp -.i "This option is not yet implemented." -.KY sourceany -.IP "sourceany [off]" +@sp 1 +@emph{This option is not yet implemented.} +@cindex sourceany +@IP{sourceany [off]} + If this option is turned on, -.CO vi +@CO{vi} historically read startup files that were owned by someone other than the editor user. See the section entitled -.QB "Startup Information" +@QB{Startup Information} for more information. This option is a security problem of immense proportions, and should not be used under any circumstances. -.sp -.i "This option will never be implemented." -.KY tabstop -.IP "tabstop, ts [8]" +@sp 1 +@emph{This option will never be implemented.} +@cindex tabstop +@IP{tabstop, ts [8]} + This option sets tab widths for the editor display. -.KY taglength -.IP "taglength, tl [0]" +@cindex taglength +@IP{taglength, tl [0]} + This option sets the maximum number of characters that are considered significant in a tag name. Setting the value to 0 makes all of the characters in the tag name significant. -.KY tags -.IP "tags, tag [tags /var/db/libc.tags /sys/kern/tags]" +@cindex tags +@IP{tags, tag [tags /var/db/libc.tags /sys/kern/tags]} + Sets the list of tags files, in search order, which are used when the editor searches for a tag. -.KY term -.IP "term, ttytype, tty [environment variable TERM]" +@cindex term +@IP{term, ttytype, tty [environment variable TERM]} + Set the terminal type. Setting this option causes -.EV ex vi +@EV{ex,vi} to set (or reset) the environmental variable -.LI TERM . -.KY terse -.IP "terse [off]" +@LI{TERM}. +@cindex terse +@IP{terse [off]} + This option has historically made editor messages less verbose. It has no effect in this implementation. See the -.OP verbose +@OP{verbose} option for more information. -.KY tildeop -.IP "tildeop [off]" +@cindex tildeop +@IP{tildeop [off]} + Modify the -.CO ~ +@CO{~} command to take an associated motion. -.KY timeout -.IP "timeout, to [on]" +@cindex timeout +@IP{timeout, to [on]} + If this option is set, -.EV ex vi +@EV{ex,vi} waits for a specific period for a subsequent key to complete a key mapping (see the -.OP keytime +@OP{keytime} option). If the option is not set, the editor waits until enough keys are entered to resolve the ambiguity, regardless of how long it takes. -.KY ttywerase -.IP "ttywerase [off]" -.CO Vi +@cindex ttywerase +@IP{ttywerase [off]} + +@CO{Vi} only. This option changes how -.CO vi +@CO{vi} does word erase during text input. If this option is set, text is broken up into two classes, blank characters and nonblank characters. Changing from one class to another marks the end of a word. -.KY verbose -.IP "verbose [off]" -.CO Vi +@cindex verbose +@IP{verbose [off]} + +@CO{Vi} only. -.CO Vi +@CO{Vi} historically bells the terminal for many obvious mistakes, e.g. trying to move past the left-hand margin, or past the end of the file. If this option is set, an error message is displayed for all errors. -.KY w300 -.IP "w300 [no default]" -.CO Vi +@cindex w300 +@IP{w300 [no default]} + +@CO{Vi} only. Set the window size if the baud rate is less than 1200 baud. See the -.OP window +@OP{window} option for more information. -.KY w1200 -.IP "w1200 [no default]" -.CO Vi +@cindex w1200 +@IP{w1200 [no default]} + +@CO{Vi} only. Set the window size if the baud rate is equal to 1200 baud. See the -.OP window +@OP{window} option for more information. -.KY w9600 -.IP "w9600 [no default]" -.CO Vi +@cindex w9600 +@IP{w9600 [no default]} + +@CO{Vi} only. Set the window size if the baud rate is greater than 1200 baud. See the -.OP window +@OP{window} option for more information. -.KY warn -.IP "warn [on]" -.CO Ex +@cindex warn +@IP{warn [on]} + +@CO{Ex} only. This option causes a warning message to the terminal if the file has been modified, since it was last written, before a -.CO ! +@CO{!} command. -.KY window -.IP "window, w, wi [environment variable LINES - 1]" +@cindex window +@IP{window, w, wi [environment variable LINES - 1]} + This option determines the default number of lines in a screenful, as displayed by the -.CO z +@CO{z} command. It also determines the number of lines scrolled by the -.CO vi +@CO{vi} commands -.CO +@CO{} and -.CO , +@CO{}, and the default number of lines scrolled by the -.CO vi +@CO{vi} commands -.CO +@CO{} and -.CO . +@CO{}. The value of window can be unrelated to the real screen size, although it starts out as the number of lines on the screen. See the section entitled -.QB "Sizing the Screen" +@QB{Sizing the Screen} for more information. Setting the value of the -.OP window +@OP{window} option is the same as using the -.b \-w +@strong{-w} command line option. -.sp +@sp 1 If the value of the -.OP window +@OP{window} option (as set by the -.OP window , -.OP w300 , -.OP w1200 +@OP{window}, +@OP{w300}, +@OP{w1200} or -.OP w9600 +@OP{w9600} options) is smaller than the actual size of the screen, large screen movements will result in displaying only that smaller number of lines on the screen. @@ -1206,98 +1248,101 @@ number of lines on the screen. filled.) This can provide a performance improvement when viewing different places in one or more files over a slow link. -.sp +@sp 1 Resetting the window size does not reset the default number of lines scrolled by the -.CO +@CO{} and -.CO +@CO{} commands. -.KY windowname -.IP "windowname [off]" -.CO Vi +@cindex windowname +@IP{windowname [off]} + +@CO{Vi} changes the name of the editor's icon/window to the current file name when it's possible and not destructive, i.e., when the editor can restore it to its original value on exit or when the icon/window will be discarded as the editor exits. If the -.OP windowname +@OP{windowname} edit option is set, -.CO vi +@CO{vi} will change the icon/window name even when it's destructive and the icon/window name will remain after the editor exits. (This is the case for -.XR xterm 1 ). -.KY wraplen -.IP "wraplen, wl [0]" +@XR{xterm,1}). +@cindex wraplen +@IP{wraplen, wl [0]} + This option is identical to the -.OP wrapmargin +@OP{wrapmargin} option, with the exception that it specifies the number of columns from the -.i left +@emph{left} margin before the line splits, not the right margin. -.sp +@sp 1 If both -.OP wraplen +@OP{wraplen} and -.OP wrapmargin +@OP{wrapmargin} are set, the -.OP wrapmargin +@OP{wrapmargin} value is used. -.KY wrapmargin -.IP "wrapmargin, wm [0]" -.CO Vi +@cindex wrapmargin +@IP{wrapmargin, wm [0]} + +@CO{Vi} only. If the value of the -.OP wrapmargin +@OP{wrapmargin} option is non-zero, -.CO vi +@CO{vi} will split lines so that they end at least that number of columns before the right-hand margin of the screen. (Note, the value of -.OP wrapmargin +@OP{wrapmargin} is -.i not +@emph{not} a text length. In a screen that is 80 columns wide, the command -.QT ":set wrapmargin=8" +@QT{:set wrapmargin=8} attempts to keep the lines less than or equal to 72 columns wide.) -.sp +@sp 1 Lines are split at the previous whitespace character closest to the number. Any trailing whitespace characters before that character are deleted. If the line is split because of an inserted -.LI -or -.LI -character, and you then enter another -.LI -character, it is discarded. -.sp +@LI{}or +@LI{}character, and you then enter another +@LI{}character, it is discarded. +@sp 1 If wrapmargin is set to 0, or if there is no blank character upon which to split the line, the line is not broken. -.sp +@sp 1 If both -.OP wraplen +@OP{wraplen} and -.OP wrapmargin +@OP{wrapmargin} are set, the -.OP wrapmargin +@OP{wrapmargin} value is used. -.KY wrapscan -.IP "wrapscan, ws [on]" +@cindex wrapscan +@IP{wrapscan, ws [on]} + This option causes searches to wrap around the end or the beginning of the file, and back to the starting point. Otherwise, the end or beginning of the file terminates the search. -.KY writeany -.IP "writeany, wa [off]" +@cindex writeany +@IP{writeany, wa [off]} + If this option is set, file-overwriting checks that would usually be made before the -.CO write +@CO{write} and -.CO xit +@CO{xit} commands, or before an automatic write (see the -.OP autowrite +@OP{autowrite} option), are not made. This allows a write to any file, provided the file permissions allow it. +@end itemize diff --git a/docs/vi.ref/vi.cmd.roff b/docs/vi.ref/vi.cmd.texi similarity index 65% rename from docs/vi.ref/vi.cmd.roff rename to docs/vi.ref/vi.cmd.texi index c7be8600..335a60f0 100644 --- a/docs/vi.ref/vi.cmd.roff +++ b/docs/vi.ref/vi.cmd.texi @@ -1,77 +1,75 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 1994, 1995, 1996 -.\" Keith Bostic. All rights reserved. -.\" -.\" See the LICENSE file for redistribution information. -.\" -.\" $Id: vi.cmd.roff,v 8.50 2001/01/28 13:48:00 skimo Exp $ (Berkeley) $Date: 2001/01/28 13:48:00 $ -.\" -.SH 1 "Vi Description" -.pp -.CO Vi -takes up the entire screen to display the edited file, +@comment Copyright (c) 1994 +@comment The Regents of the University of California. All rights reserved. +@comment Copyright (c) 1994, 1995, 1996 +@comment Keith Bostic. All rights reserved. +@comment +@comment See the LICENSE file for redistribution information. +@comment +@comment $Id: vi.cmd.texi,v 8.1 2001/08/18 20:43:49 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:49 $ +@comment +@chapter Vi Description + +@CO{Vi} takes up the entire screen to display the edited file, except for the bottom line of the screen. The bottom line of the screen is used to enter -.CO ex +@CO{exp} commands, and for -.CO vi +@CO{vi} error and informational messages. If no other information is being displayed, the default display can show the current cursor row and cursor column, an indication of whether the file has been modified, and the current mode of the editor. See the -.OP ruler +@OP{ruler} and -.OP showmode +@OP{showmode} options for more information. -.pp + Empty lines do not have any special representation on the screen, but lines on the screen that would logically come after the end of the file are displayed as a single tilde -.PQ ~ +@PQ{~} character. To differentiate between empty lines and lines consisting of only whitespace characters, use the -.OP list +@OP{list} option. Historically, implementations of -.CO vi +@CO{vi} have also displayed some lines as single asterisk -.PQ @ +@PQ{@@} characters. These were lines that were not correctly displayed, i.e. lines on the screen that did not correspond to lines in the file, or lines that did not fit on the current screen. -.CO Nvi +@CO{Nvi} never displays lines in this fashion. -.pp -.CO Vi + +@CO{Vi} is a modeful editor, i.e. it has two modes, -.QQ command +@QQ{command} mode and -.QQ "text input" +@QQ{text input} mode. When -.CO vi +@CO{vi} first starts, it is in command mode. There are several commands that change -.CO vi +@CO{vi} into text input mode. The -.LI -character is used to resolve the text input into the file, +@LI{}character is used to resolve the text input into the file, and exit back into command mode. In -.CO vi +@CO{vi} command mode, the cursor is always positioned on the last column of characters which take up more than one column on the screen. In -.CO vi +@CO{vi} text insert mode, the cursor is positioned on the first column of characters which take up more than one column on the screen. -.pp + When positioning the cursor to a new line and column, the type of movement is defined by the distance to the new cursor position. If the new position is close, @@ -86,27 +84,27 @@ the cursor line will appear in the center of the screen, unless the cursor is sufficiently close to the beginning or end of the file that this isn't possible. If the -.OP leftright +@OP{leftright} option is set, the screen may be scrolled or repainted in a horizontal direction as well as in a vertical one. -.pp + A major difference between the historical -.CO vi +@CO{vi} presentation and -.CO nvi +@CO{nvi} is in the scrolling and screen oriented position commands, -.CO , -.CO , -.CO , -.CO , -.CO , -.CO , -.CO H , -.CO L +@CO{}, +@CO{}, +@CO{}, +@CO{}, +@CO{}, +@CO{}, +@CO{H}, +@CO{L} and -.CO M . +@CO{M}. In historical implementations of -.CO vi , +@CO{vi}, these commands acted on physical (as opposed to logical, or screen) lines. For lines that were sufficiently long in relation to the size of the @@ -114,27 +112,27 @@ screen, this meant that single line scroll commands might repaint the entire screen, scrolling or screen positioning commands might not change the screen or move the cursor at all, and some lines simply could not be displayed, even though -.CO vi +@CO{vi} would edit the file that contained them. In -.CO nvi , +@CO{nvi}, these commands act on logical, i.e. screen lines. You are unlikely to notice any difference unless you are editing files with lines significantly longer than a screen width. -.pp -.CO Vi + +@CO{Vi} keeps track of the currently -.QQ "most attractive" +@QQ{most attractive} cursor position. Each command description (for commands that alter the current cursor position), specifies if the cursor is set to a specific location in the line, or if it is moved to the -.QQ "most attractive cursor position" . +@QQ{most attractive cursor position}. The latter means that the cursor is moved to the cursor position that is horizontally as close as possible to the current cursor position. If the current line is shorter than the cursor position -.CO vi +@CO{vi} would select, the cursor is positioned on the last character in the line. (If the line is empty, the cursor is positioned on the first column of the line.) @@ -145,55 +143,58 @@ Therefore, although a movement to a line shorter than the currently most attractive position will cause the cursor to move to the end of that line, a subsequent movement to a longer line will cause the cursor to move back to the most attractive position. -.pp + In addition, the -.CO $ +@CO{$} command makes the end of each line the most attractive cursor position rather than a specific column. -.pp + Each -.CO vi +@CO{vi} command described below notes where the cursor ends up after it is executed. This position is described in terms of characters on the line, i.e. -.QQ "the previous character" , +@QQ{the previous character}, or, -.QQ "the last character in the line" . +@QQ{the last character in the line}. This is to avoid needing to continually refer to on what part of the character the cursor rests. -.pp + The following words have special meaning for -.CO vi +@CO{vi} commands. -.KY "previous context" -.IP "previous context" +@itemize @bullet +@cindex "previous context" +@IP{previous context} + The position of the cursor before the command which caused the last absolute movement was executed. Each -.CO vi +@CO{vi} command described in the next section that is considered an absolute movement is so noted. In addition, specifying -.i any +@emph{any} address to an -.CO ex +@CO{ex} command is considered an absolute movement. -.KY "motion" -.IP "motion" +@cindex "motion" +@IP{motion} + A second -.CO vi +@CO{vi} command can be used as an optional trailing argument to the -.CO vi -.CO \&< , -.CO \&> , -.CO \&! , -.CO \&c , -.CO \&d , -.CO \&y , +@CO{vi} +@CO{<}, +@CO{>}, +@CO{!}, +@CO{c}, +@CO{d}, +@CO{y}, and (depending on the -.OP tildeop +@OP{tildeop} option) -.CO \&~ +@CO{~} commands. This command indicates the end of the region of text that's affected by the command. @@ -209,77 +210,74 @@ partially in the region. In addition, some other commands become line oriented depending on where in the text they are used. The command descriptions below note these special cases. -.sp +@sp 1 The following commands may all be used as motion components for -.CO vi +@CO{vi} commands: -.sp -.ne 12v -.ft C -.TS -r r r r. - - $ -% ' ( ) -+ , - / -0 ; ? B -E F G H -L M N T -W [[ ]] ^ -\&_ ` b e -f h j k -l n t w -{ | } -.TE -.ft R -.sp +@sp 1 +@multitable {@CO{}} {@CO{'}} {@CO{}} {@CO{}} +@item @CO{} @tab @CO{} @tab @CO{} @tab @CO{} +@item @CO{} @tab @CO{} @tab @CO{} @tab @CO{$} +@item @CO{%} @tab @CO{'} @tab @CO{(} @tab @CO{)} +@item @CO{+} @tab @CO{,} @tab @CO{-} @tab @CO{/} +@item @CO{0} @tab @CO{;} @tab @CO{?} @tab @CO{B} +@item @CO{E} @tab @CO{F} @tab @CO{G} @tab @CO{H} +@item @CO{L} @tab @CO{M} @tab @CO{N} @tab @CO{T} +@item @CO{W} @tab @CO{[[} @tab @CO{]]} @tab @CO{^} +@item @CO{_} @tab @CO{`} @tab @CO{b} @tab @CO{e} +@item @CO{f} @tab @CO{h} @tab @CO{j} @tab @CO{k} +@item @CO{l} @tab @CO{n} @tab @CO{t} @tab @CO{w} +@item @strong{@{} @tab @CO{|} @tab @strong{@}} +@end multitable +@sp 1 The optional count prefix available for some of the -.CO vi +@CO{vi} commands that take motion commands, or the count prefix available for the -.CO vi +@CO{vi} commands that are used as motion components, may be included and is -.i always +@emph{always} considered part of the motion argument. For example, the commands -.QT c2w +@QT{c2w} and -.QT 2cw +@QT{2cw} are equivalent, and the region affected by the -.CO c +@CO{c} command is two words of text. In addition, if the optional count prefix is specified for both the -.CO vi +@CO{vi} command and its motion component, the effect is multiplicative and is considered part of the motion argument. For example, the commands -.QT 4cw +@QT{4cw} and -.QT 2c2w +@QT{2c2w} are equivalent, and the region affected by the -.CO c +@CO{c} command is four words of text. -.KY "count" -.IP "count" +@cindex "count" +@IP{count} + A positive number used as an optional argument to most commands, either to give a size or a position (for display or movement commands), or as a repeat count (for commands that modify text). The count argument is always optional and defaults to 1 unless otherwise noted in the command description. -.sp +@sp 1 When a -.CO vi +@CO{vi} command synopsis shows both a -.LI [buffer] -and -.LI [count] , +@LI{[buffer]}and +@LI{[count]}, they may be presented in any order. -.KY word -.IP word +@cindex word +@IP{word} + Generally, in languages where it is applicable, -.CO vi +@CO{vi} recognizes two kinds of words. First, a sequence of letters, digits and underscores, delimited at both ends by: @@ -290,88 +288,95 @@ or whitespace characters, delimited at both ends by: a letter, digit, underscore, or whitespace character, the beginning or end of a line, and the beginning or end of the file. For example, the characters -.QT " !@#abc$%^ " +@QT{ !@@#abc$%^ } contain three words: -.QT "!@#" , -.QT "abc" +@QT{!@@#}, +@QT{abc} and -.QT "$%^" . -.sp +@QT{$%^}. +@sp 1 Groups of empty lines (or lines containing only whitespace characters) are treated as a single word. -.KY "bigword" -.IP "bigword" +@cindex "bigword" +@IP{bigword} + A set of non-whitespace characters preceded and followed by whitespace characters or the beginning or end of the file or line. For example, the characters -.QT " !@#abc$%^ " +@QT{ !@@#abc$%^ } contain one bigword: -.QT "!@#abc$%^" . -.sp +@QT{!@@#abc$%^}. +@sp 1 Groups of empty lines (or lines containing only whitespace characters) are treated as a single bigword. -.KY "paragraph" -.IP "paragraph" +@cindex "paragraph" +@IP{paragraph} + An area of text that begins with either the beginning of a file, an empty line, or a section boundary, and continues until either an empty line, section boundary, or the end of the file. -.sp +@sp 1 Groups of empty lines (or lines containing only whitespace characters) are treated as a single paragraph. -.sp +@sp 1 Additional paragraph boundaries can be defined using the -.OP paragraphs +@OP{paragraphs} option. -.KY "section" -.IP "section" +@cindex "section" +@IP{section} + An area of text that starts with the beginning of the file or a line whose first character is an open brace -.PQ { +@comment PQ +``@code{@{}'' and continues until the next section or the end of the file. -.sp +@sp 1 Additional section boundaries can be defined using the -.OP sections +@OP{sections} option. -.KY "sentence" -.IP "sentence" +@cindex "sentence" +@IP{sentence} + An area of text that begins with either the beginning of the file or the first nonblank character following the previous sentence, paragraph, or section boundary and continues until the end of the file or a period -.PQ \&. +@PQ{.} exclamation point -.PQ ! +@PQ{!} or question mark -.PQ ? +@PQ{?} character, followed by either an end-of-line or two whitespace characters. Any number of closing parentheses -.PQ ) , +@PQ{)}, brackets -.PQ ] , +@PQ{]}, double-quote -.PQ """" +@PQ{"} or single quote -.PQ ' +@PQ{'} characters can appear between the period, exclamation point, or question mark and the whitespace characters or end-of-line. -.sp +@sp 1 Groups of empty lines (or lines containing only whitespace characters) are treated as a single sentence. -.SH 1 "Vi Commands" -.pp +@chapter Vi Commands +@end itemize + The following section describes the commands available in the command mode of the -.CO vi +@CO{vi} editor. In each entry below, the tag line is a usage synopsis for the command character. In addition, the final line and column the cursor rests upon, and any options which affect the command are noted. -.KY -.IP "[count] " + +@cindex +@deftypefn Command {[count]} {} + Search forward -.LI count -times for the current word. +@LI{count}times for the current word. The current word begins at the first non-whitespace character on or after the current cursor position, and extends up to the next non-word character or the end of the line. @@ -379,397 +384,416 @@ The search is literal, i.e. no characters in the word have any special meaning in terms of Regular Expressions. It is an error if no matching pattern is found between the starting position and the end of the file. -.sp +@sp 1 The -.CO +@CO{} command is an absolute movement. The -.CO +@CO{} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line where the word is found. -.SP Column: +@item Column: Set to the first character of the word. -.SP Options: +@item Options: Affected by the -.OP ignorecase +@OP{ignorecase} and -.OP wrapscan +@OP{wrapscan} options. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Page backward -.LI count -screens. +@LI{count}screens. Two lines of overlap are maintained, if possible, by displaying the window starting at line -.LI "(top_line - count * window_size) + 2" , +@LI{(top_line - count * window_size) + 2}, where -.LI window_size -is the value of the -.OP window +@LI{window_size}is the value of the +@OP{window} option. (In the case of split screens, this size is corrected to the current screen size.) It is an error if the movement is past the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line of text displayed on the screen. -.SP Column: +@item Column: Set to the first nonblank character of the line. -.SP Options: +@item Options: Affected by the -.OP window +@OP{window} option. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Scroll forward -.LI count -lines. +@LI{count}lines. If -.LI count -is not specified, scroll forward the number of lines specified by the last -.CO +@LI{count}is not specified, scroll forward the number of lines specified by the last +@CO{} or -.CO +@CO{} command. If this is the first -.CO +@CO{} or -.CO +@CO{} command, scroll forward half the number of lines in the screen. (In the case of split screens, the default scrolling distance is corrected to half the current screen size.) It is an error if the movement is past the end of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line plus the number of lines scrolled. -.SP Column: +@item Column: Set to the first nonblank character of the line. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Scroll forward -.LI count -lines, leaving the cursor on the current line and column, if possible. +@LI{count}lines, leaving the cursor on the current line and column, if possible. It is an error if the movement is past the end of the file. -.SS -.SP Line: +@table @asis +@item Line: Unchanged unless the current line scrolls off the screen, in which case it is set to the first line on the screen. -.SP Column: +@item Column: Unchanged unless the current line scrolls off the screen, in which case it is set to the most attractive cursor position. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Page forward -.LI count -screens. +@LI{count}screens. Two lines of overlap are maintained, if possible, by displaying the window starting at line -.LI "top_line + count * window_size - 2" , +@LI{top_line + count * window_size - 2}, where -.LI window_size -is the value of the -.OP window +@LI{window_size}is the value of the +@OP{window} option. (In the case of split screens, this size is corrected to the current screen size.) It is an error if the movement is past the end of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the first line on the screen. -.SP Column: +@item Column: Set to the first nonblank character of the current line. -.SP Options: +@item Options: Affected by the -.OP window +@OP{window} option. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Display the file information. The information includes the current pathname, the current line, the number of total lines in the file, the current line as a percentage of the total lines in the file, if the file has been modified, was able to be locked, if the file's name has been changed, and if the edit session is read-only. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " -.Ip "[count] h" +@end table +@end deftypefn + +@cindex +@deftypefn Command {[count]} {} +@deftypefnx Command {[count]} {h} Move the cursor back -.LI count -characters in the current line. +@LI{count}characters in the current line. It is an error if the cursor is on the first character in the line. -.sp +@sp 1 The -.CO +@CO{} and -.CO h +@CO{h} commands may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the -.LI "current - count" -character, or, the first character in the line if -.LI count -is greater than or equal to the number of characters in the line +@LI{current - count}character, or, the first character in the line if +@LI{count}is greater than or equal to the number of characters in the line before the cursor. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " -.KY -.Ip "[count] " -.KY j -.Ip "[count] j" +@end table +@end deftypefn + +@cindex +@deftypefn Command {[count]} {} + +@cindex +@deftypefnx Command {[count]} {} +@cindex j +@deftypefnx Command {[count]} {j} Move the cursor down -.LI count -lines without changing the current column. +@LI{count}lines without changing the current column. It is an error if the movement is past the end of the file. -.sp +@sp 1 The -.CO , -.CO +@CO{}, +@CO{} and -.CO j +@CO{j} commands may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line plus -.LI count . -.SP Column: +@LI{count}. +@item Column: The most attractive cursor position. -.SP Options: +@item Options: None. -.SE -.KY -.IP "" -.KY -.Ip "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + +@cindex +@deftypefnx Command {} {} Repaint the screen. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " -.KY + -.Ip "[count] +" +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + +@cindex + +@deftypefnx Command {[count]} {+} Move the cursor down -.LI count -lines to the first nonblank character of that line. +@LI{count}lines to the first nonblank character of that line. It is an error if the movement is past the end of the file. -.sp +@sp 1 The -.CO +@CO{} and -.CO + +@CO{+} commands may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line plus -.LI count . -.SP Column: +@LI{count}. +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " -.KY k -.Ip "[count] k" +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + +@cindex k +@deftypefnx Command {[count]} {k} Move the cursor up -.LI count -lines, without changing the current column. +@LI{count}lines, without changing the current column. It is an error if the movement is past the beginning of the file. -.sp +@sp 1 The -.CO +@CO{} and -.CO k +@CO{k} commands may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line minus -.LI count . -.SP Column: +@LI{count}. +@item Column: The most attractive cursor position. -.SP Options: +@item Options: None. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Return to the most recent tag context. The -.CO +@CO{} command is an absolute movement. -.SS -.SP Line: +@table @asis +@item Line: Set to the context of the previous tag command. -.SP Column: +@item Column: Set to the context of the previous tag command. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Scroll backward -.LI count -lines. +@LI{count}lines. If -.LI count -is not specified, scroll backward the number of lines specified by the +@LI{count}is not specified, scroll backward the number of lines specified by the last -.CO +@CO{} or -.CO +@CO{} command. If this is the first -.CO +@CO{} or -.CO +@CO{} command, scroll backward half the number of lines in the screen. (In the case of split screens, the default scrolling distance is corrected to half the current screen size.) It is an error if the movement is past the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line minus the amount scrolled. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Switch to the next lower screen in the window, or, to the first screen if there are no lower screens in the window. -.SS -.SP Line: +@table @asis +@item Line: Set to the previous cursor position in the window. -.SP Column: +@item Column: Set to the previous cursor position in the window. -.SP Options: +@item Options: None. -.SE -.KY -.IP "[count] " +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + Scroll backward -.LI count -lines, leaving the current line and column as is, if possible. +@LI{count}lines, leaving the current line and column as is, if possible. It is an error if the movement is past the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Unchanged unless the current line scrolls off the screen, in which case it is set to the last line of text displayed on the screen. -.SP Column: +@item Column: Unchanged unless the current line scrolls off the screen, in which case it is the most attractive cursor position. -.SP Options: +@item Options: None. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Suspend the current editor session. If the file has been modified since it was last completely written, and the -.OP autowrite +@OP{autowrite} option is set, the file is written before the editor session is suspended. If this write fails, the editor session is not suspended. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} option. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Execute -.CO ex +@CO{ex} commands or cancel partial commands. If an -.CO ex +@CO{ex} command is being entered (e.g. -.CO / , -.CO ? , -.CO : +@CO{/}, +@CO{?}, +@CO{:} or -.CO ! ), +@CO{!}), the command is executed. If a partial command has been entered, e.g. -.QT "[0-9]*" , +@QT{[0-9]*}, or -.QT "[0-9]*[!<>cdy]" , +@QT{[0-9]*[!<>cdy]}, the command is cancelled. Otherwise, it is an error. -.SS -.SP Line: +@table @asis +@item Line: When an -.CO ex +@CO{ex} command is being executed, the current line is set as described for that command. Otherwise, unchanged. -.SP Column: +@item Column: When an -.CO ex +@CO{ex} command is being executed, the current column is set as described for that command. Otherwise, unchanged. -.SP Options: +@item Options: None. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Push a tag reference onto the tag stack. The tags files (see the -.OP tags +@OP{tags} option for more information) are searched for a tag matching the current word. The current word begins at the first non-whitespace character on or @@ -777,386 +801,388 @@ after the current cursor position, and extends up to the next non-word character or the end of the line. If a matching tag is found, the current file is discarded and the file containing the tag reference is edited. -.sp +@sp 1 If the current file has been modified since it was last completely written, the command will fail. The -.CO +@CO{} command is an absolute movement. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the matching tag string. -.SP Column: +@item Column: Set to the start of the matching tag string. -.SP Options: +@item Options: Affected by the -.OP tags +@OP{tags} and -.OP taglength +@OP{taglength} options. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Switch to the most recently edited file. -.sp +@sp 1 If the file has been modified since it was last completely written, and the -.OP autowrite +@OP{autowrite} option is set, the file is written out. If this write fails, the command will fail. Otherwise, if the current file has been modified since it was last completely written, the command will fail. -.SS -.SP Line: +@table @asis +@item Line: Set to the line the cursor was on when the file was last edited. -.SP Column: +@item Column: Set to the column the cursor was on when the file was last edited. -.SP Options: +@item Options: Affected by the -.OP autowrite +@OP{autowrite} option. -.SE -.KY -.IP "[count] " -.KY l -.Ip "[count] l" +@end table +@end deftypefn +@cindex +@deftypefn Command {[count]} {} + +@cindex l +@deftypefnx Command {[count]} {l} Move the cursor forward -.LI count -characters without changing the current line. +@LI{count}characters without changing the current line. It is an error if the cursor is on the last character in the line. -.sp +@sp 1 The -.CO +@CO{} and -.CO \&l +@CO{l} commands may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. In addition, these commands may be used as the motion components of other commands when the cursor is on the last character in the line, without error. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the current character plus the next -.LI count -characters, or to the last character on the line if -.LI count -is greater than the number of characters in the line after the +@LI{count}characters, or to the last character on the line if +@LI{count}is greater than the number of characters in the line after the current character. -.SP Options: +@item Options: None. -.SE -.KY ! -.IP "[count] ! motion shell-argument(s)" +@end table +@end deftypefn +@cindex ! +@deftypefn Command {[count]} {!} {motion shell-argument(s)} + Replace text with results from a shell command. Pass the lines specified by the -.LI count -and -.LI motion -arguments as standard input to the program named by the -.OP shell +@LI{count}and +@LI{motion}arguments as standard input to the program named by the +@OP{shell} option, and replace those lines with the output (both standard error and standard output) of that command. -.sp +@sp 1 After the motion is entered, -.CO vi +@CO{vi} prompts for arguments to the shell command. -.sp +@sp 1 Within those arguments, -.QT % +@QT{%} and -.QT # +@QT{#} characters are expanded to the current and alternate pathnames, respectively. The -.QT ! +@QT{!} character is expanded with the command text of the previous -.CO ! +@CO{!} or -.CO :! +@CO{:!} commands. (Therefore, the command -.CO !! +@CO{!!} repeats the previous -.CO ! +@CO{!} command.) The special meanings of -.QT % , -.QT # +@QT{%}, +@QT{#} and -.QT ! +@QT{!} can be overridden by escaping them with a backslash. If no -.CO ! +@CO{!} or -.CO :! +@CO{:!} command has yet been executed, it is an error to use an unescaped -.QT ! +@QT{!} character as a shell argument. The -.CO ! +@CO{!} command does -.i not +@emph{not} do shell expansion on the strings provided as arguments. If any of the above expansions change the arguments the user entered, the command is redisplayed at the bottom of the screen. -.sp -.CO Vi +@sp 1 +@CO{Vi} then executes the program named by the -.OP shell +@OP{shell} option, with a -.b \-c +@strong{-c} flag followed by the arguments (which are bundled into a single argument). -.sp +@sp 1 The -.CO ! +@CO{!} command is permitted in an empty file. -.sp +@sp 1 If the file has been modified since it was last completely written, the -.CO ! +@CO{!} command will warn you. -.SS -.SP Line: +@table @asis +@item Line: The first line of the replaced text. -.SP Column: +@item Column: The first column of the replaced text. -.SP Options: +@item Options: Affected by the -.OP shell +@OP{shell} option. -.SE -.KY # -.IP "[count] # #|+|-" +@end table +@end deftypefn +@cindex # +@deftypefn Command {[count]} {#} {#|+|-} + Increment or decrement the number referenced by the cursor. If the trailing character is a -.LI \&+ -or -.LI \&# , +@LI{+}or +@LI{#}, the number is incremented by -.LI count . +@LI{count}. If the trailing character is a -.LI \&- , +@LI{-}, the number is decremented by -.LI count . -.sp +@LI{count}. +@sp 1 A leading -.QT \&0X +@QT{0X} or -.QT \&0x +@QT{0x} causes the number to be interpreted as a hexadecimal number. Otherwise, a leading -.QT \&0 +@QT{0} causes the number to be interpreted as an octal number, unless a non-octal digit is found as part of the number. Otherwise, the number is interpreted as a decimal number, and may have a leading -.LI \&+ -or -.LI \&- -sign. +@LI{+}or +@LI{-}sign. The current number begins at the first non-blank character at or after the current cursor position, and extends up to the end of the line or the first character that isn't a possible character for the numeric type. The format of the number (e.g. leading 0's, signs) is retained unless the new value cannot be represented in the previous format. -.sp +@sp 1 Octal and hexadecimal numbers, and the result of the operation, must fit into an -.QT "unsigned long" . +@QT{unsigned long}. Similarly, decimal numbers and their result must fit into a -.QT "signed long" . +@QT{signed long}. It is an error to use this command when the cursor is not positioned at a number. -.sp -.SS -.SP Line: +@sp 1 +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the first character in the cursor number. -.SP Options: +@item Options: None. -.SE -.KY $ -.IP "[count] $" +@end table +@end deftypefn +@cindex $ +@deftypefn Command {[count]} {$} + Move the cursor to the end of a line. If -.LI count -is specified, the cursor moves down -.LI "count - 1" -lines. -.sp +@LI{count}is specified, the cursor moves down +@LI{count - 1}lines. +@sp 1 It is not an error to use the -.CO $ +@CO{$} command when the cursor is on the last character in the line or when the line is empty. -.sp +@sp 1 The -.CO $ +@CO{$} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the cursor is at, or before the first nonblank character in the line, in which case it is line oriented. It is not an error to use the -.CO $ +@CO{$} command as a motion component when the cursor is on the last character in the line, although it is an error when the line is empty. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line plus -.LI count -minus 1. -.SP Column: +@LI{count}minus 1. +@item Column: Set to the last character in the line. -.SP Options: +@item Options: None. -.SE -.KY % -.IP % +@end table +@end deftypefn +@cindex % +@deftypefn Command {} {%} + Move to the matching character. The cursor moves to the parenthesis or curly brace which -.i matches +@emph{matches} the parenthesis or curly brace found at the current cursor position or which is the closest one to the right of the cursor on the line. It is an error to execute the -.CO % +@CO{%} command on a line without a parenthesis or curly brace. Historically, any -.LI count -specified to the -.CO % +@LI{count}specified to the +@CO{%} command was ignored. -.sp +@sp 1 The -.CO % +@CO{%} command is an absolute movement. The -.CO % +@CO{%} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting point of the region is at or before the first nonblank character on its line, and the ending point is at or after the last nonblank character on its line, in which case it is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the matching character. -.SP Column: +@item Column: Set to the matching character. -.SP Options: +@item Options: None. -.SE -.KY & -.IP "&" +@end table +@end deftypefn +@cindex & +@deftypefn Command {} {&} + Repeat the previous substitution command on the current line. -.sp +@sp 1 Historically, any -.LI count -specified to the -.CO & +@LI{count}specified to the +@CO{&} command was ignored. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged if the cursor was on the last character in the line, otherwise, set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP edcompatible , -.OP extended , -.OP ignorecase +@OP{edcompatible}, +@OP{extended}, +@OP{ignorecase} and -.OP magic +@OP{magic} options. -.SE -.KY SQUOTE -.IP \' -.KY ` -.Ip ` +@end table +@end deftypefn +@cindex SQUOTE +@deftypefn Command {} {'} + +@cindex ` +@deftypefnx Command {} ` Return to a context marked by the character -.LI . +@LI{}. If -.LI -is the -.QT ' +@LI{}is the +@QT{'} or -.QT ` +@QT{`} character, return to the previous context. If -.LI -is any other character, +@LI{}is any other character, return to the context marked by that character (see the -.CO m +@CO{m} command for more information). If the command is the -.CO \' +@CO{\'} command, only the line value is restored, and the cursor is placed on the first nonblank character of that line. If the command is the -.CO ` +@CO{`} command, both the line and column values are restored. -.sp +@sp 1 It is an error if the context no longer exists because of line deletion. (Contexts follow lines that are moved, or which are deleted and then restored.) -.sp +@sp 1 The -.CO \' +@CO{\'} and -.CO ` +@CO{`} commands are both absolute movements. They may be used as a motion component for other -.CO vi +@CO{vi} commands. For the -.CO \' +@CO{\'} command, any text copied into a buffer is line oriented. For the -.CO ` +@CO{`} command, any text copied into a buffer is character oriented, unless it both starts and stops at the first character in the line, in which case it is line oriented. In addition, when using the -.CO ` +@CO{`} command as a motion component, commands which move backward and started at the first character in the line, or move forward and ended at the first character in the line, are corrected to the last character of the line preceding the starting and ending lines, respectively. -.SS -.SP Line: +@table @asis +@item Line: Set to the line from the context. -.SP Column: +@item Column: Set to the first nonblank character in the line, for the -.CO \' +@CO{\'} command, and set to the context's column for the -.CO ` +@CO{`} command. -.SP Options: +@item Options: None. -.SE -.KY ( -.IP "[count] (" +@end table +@end deftypefn +@cindex ( +@deftypefn Command {} {[count] (} + Back up -.LI count -sentences. -.sp +@LI{count}sentences. +@sp 1 The -.CO ( +@CO{(} command is an absolute movement. The -.CO ( +@CO{(} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting and stopping points of the region are the first @@ -1165,178 +1191,182 @@ in which case it is line oriented. If it is line oriented, the starting point of the region is adjusted to be the end of the line immediately before the starting cursor position. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the beginning of the sentence. -.SP Column: +@item Column: Set to the first nonblank character of the sentence. -.SP Options: +@item Options: Affected by the -.OP lisp +@OP{lisp} option. -.SE -.KY ) -.IP "[count] )" +@end table +@end deftypefn +@cindex ) +@deftypefn Command {[count]} {)} + Move forward -.LI count -sentences. -.sp +@LI{count}sentences. +@sp 1 The -.CO ) +@CO{)} command is an absolute movement. The -.CO ) +@CO{)} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting point of the region is the first character in the line, in which case it is line oriented. In the latter case, if the stopping point of the region is also the first character in the line, it is adjusted to be the end of the line immediately before it. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the beginning of the sentence. -.SP Column: +@item Column: Set to the first nonblank character of the sentence. -.SP Options: +@item Options: Affected by the -.OP lisp +@OP{lisp} option. -.SE -.KY , -.IP "[count] ," +@end table +@end deftypefn +@cindex , +@deftypefn Command {[count]} {,} + Reverse find character -.LI count -times. +@LI{count}times. Reverse the last -.CO F , -.CO f , -.CO T +@CO{F}, +@CO{f}, +@CO{T} or -.CO t +@CO{t} command, searching the other way in the line, -.LI count -times. +@LI{count}times. It is an error if a -.CO F , -.CO f , -.CO T +@CO{F}, +@CO{f}, +@CO{T} or -.CO t +@CO{t} command has not been performed yet. -.sp +@sp 1 The -.CO , +@CO{,} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the searched-for character for the -.CO F +@CO{F} and -.CO f +@CO{f} commands, before the character for the -.CO t +@CO{t} command and after the character for the -.CO T +@CO{T} command. -.SP Options: +@item Options: None. -.SE -.KY MINUSSIGN -.IP "[count] \-" +@end table +@end deftypefn +@cindex MINUSSIGN +@deftypefn Command {[count]} {-} + Move to the first nonblank of the previous line, -.LI count -times. -.sp +@LI{count}times. +@sp 1 It is an error if the movement is past the beginning of the file. -.sp +@sp 1 The -.CO - +@CO{-} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the current line minus -.LI count . -.SP Column: +@LI{count}. +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY \&. -.IP "[count] \&." +@end table +@end deftypefn +@cindex . +@deftypefn Command {[count]} {.} + Repeat the last -.CO vi +@CO{vi} command that modified text. The repeated command may be a command and motion component combination. If -.LI count -is specified, it replaces -.i both +@LI{count}is specified, it replaces +@emph{both} the count specified for the repeated command, and, if applicable, for the repeated motion component. If -.LI count -is not specified, the counts originally specified to the command being +@LI{count}is not specified, the counts originally specified to the command being repeated are used again. -.sp +@sp 1 As a special case, if the -.CO \. +@CO{\.} command is executed immediately after the -.CO u +@CO{u} command, the change log is rolled forward or backward, depending on the action of the -.CO u +@CO{u} command. -.SS -.SP Line: +@table @asis +@item Line: Set as described for the repeated command. -.SP Column: +@item Column: Set as described for the repeated command. -.SP Options: +@item Options: None. -.SE -.KY /RE/ -.IP "/RE" -.Ip "/RE/ [offset]" -.KY ?RE? -.Ip "?RE" -.Ip "?RE? [offset]" -.KY N -.Ip "N" -.KY n -.Ip "n" +@end table +@end deftypefn +@cindex /RE/ +@deftypefn Command {} {/RE} + +@deftypefnx Command {} {/RE/} {[offset]} +@cindex ?RE? +@deftypefnx Command {} {?RE} +@deftypefnx Command {} {?RE?} {[offset]} +@cindex N +@deftypefnx Command {} N +@cindex n +@deftypefnx Command {} n Search forward or backward for a regular expression. The commands beginning with a slash -.PQ / +@PQ{/} character are forward searches, the commands beginning with a question mark -.PQ ? +@PQ{?} are backward searches. -.CO Vi +@CO{Vi} prompts with the leading character on the last line of the screen for a string. It then searches forward or backward in the file for the next occurrence of the string, which is interpreted as a Basic Regular Expression. -.sp +@sp 1 The -.CO / +@CO{/} and -.CO ? +@CO{?} commands are absolute movements. They may be used as the motion components of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the search started and ended on the first column of a line, in which case it is line oriented. @@ -1344,319 +1374,313 @@ In addition, forward searches ending at the first character of a line, and backward searches beginning at the first character in the line, are corrected to begin or end at the last character of the previous line. (Note, forward and backward searches can occur for both -.CO / +@CO{/} and -.CO ? +@CO{?} commands, if the -.OP wrapscan +@OP{wrapscan} option is set.) -.sp +@sp 1 If an offset from the matched line is specified (i.e. a trailing -.QT / +@QT{/} or -.QT ? +@QT{?} character is followed by a signed offset), the buffer will always be line oriented (e.g. -.QT /string/+0 +@QT{/string/+0} will always guarantee a line orientation). -.sp +@sp 1 The -.CO N +@CO{N} command repeats the previous search, but in the reverse direction. The -.CO n +@CO{n} command repeats the previous search. If either the -.CO N +@CO{N} or -.CO n +@CO{n} commands are used as motion components for the -.CO ! +@CO{!} command, you will not be prompted for the text of the bang command, instead the previous bang command will be executed. -.sp +@sp 1 Missing RE's (e.g. -.QT // , -.QT / , -.QT ?? , +@QT{//}, +@QT{/}, +@QT{??}, or -.QT ? +@QT{?} search for the last search RE, in the indicated direction. -.sp +@sp 1 Searches may be interrupted using the -.LI -character. -.sp +@LI{}character. +@sp 1 Multiple search patterns may be grouped together by delimiting them with semicolons and zero or more whitespace characters, e.g. -.LI "/foo/ ; ?bar?" -searches forward for -.LI foo -and then, from that location, backwards for -.LI bar . +@LI{/foo/ ; ?bar?}searches forward for +@LI{foo}and then, from that location, backwards for +@LI{bar}. When search patterns are grouped together in this manner, the search patterns are evaluated left to right with the final cursor position determined by the last search pattern. -.sp +@sp 1 It is also permissible to append a -.CO z +@CO{z} command to the search strings, e.g. -.LI "/foo/ z." -searches forward for the next occurrence of -.LI foo , +@LI{/foo/ z.}searches forward for the next occurrence of +@LI{foo}, and then positions that line in the middle of screen. -.SS -.SP Line: +@table @asis +@item Line: Set to the line in which the match occurred. -.SP Column: +@item Column: Set to the first character of the matched string. -.SP Options: +@item Options: Affected by the -.OP edcompatible , -.OP extended , -.OP ignorecase , -.OP magic , +@OP{edcompatible}, +@OP{extended}, +@OP{ignorecase}, +@OP{magic}, and -.OP wrapscan +@OP{wrapscan} options. -.SE -.KY 0 -.IP "0" +@end table +@end deftypefn +@cindex 0 +@deftypefn Command {} {0} + Move to the first character in the current line. It is not an error to use the -.CO 0 +@CO{0} command when the cursor is on the first character in the line, -.sp +@sp 1 The -.CO 0 +@CO{0} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case it is an error if the cursor is on the first character in the line, and any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the first character in the line. -.SP Options: +@item Options: None. -.SE -.KY : -.IP ":" +@end table +@end deftypefn +@cindex : +@deftypefn Command {} {:} + Execute an -.CO ex +@CO{ex} command. -.CO Vi +@CO{Vi} prompts for an -.CO ex +@CO{ex} command on the last line of the screen, using a colon -.PQ : +@PQ{:} character. The command is terminated by a -.LI , -.LI -or -.LI -character; all of these characters may be escaped by using a -.LI "" -character. +@LI{}, +@LI{}or +@LI{}character; all of these characters may be escaped by using a +@LI{}character. The command is then executed. -.sp +@sp 1 If the -.CO ex +@CO{ex} command writes to the screen, -.CO vi +@CO{vi} will prompt the user for a -.LI -before continuing +@LI{}before continuing when the -.CO ex +@CO{ex} command finishes. Large amounts of output from the -.CO ex +@CO{ex} command will be paged for the user, and the user prompted for a -.LI -or -.LI -key to continue. +@LI{}or +@LI{}key to continue. In some cases, a quit (normally a -.QQ q +@QQ{q} character) or -.LI -may be entered to interrupt the -.CO ex +@LI{}may be entered to interrupt the +@CO{ex} command. -.sp +@sp 1 When the -.CO ex +@CO{ex} command finishes, and the user is prompted to resume visual mode, it is also possible to enter another -.QT : +@QT{:} character followed by another -.CO ex +@CO{ex} command. -.SS -.SP Line: +@table @asis +@item Line: The current line is set as described for the -.CO ex +@CO{ex} command. -.SP Column: +@item Column: The current column is set as described for the -.CO ex +@CO{ex} command. -.SP Options: +@item Options: Affected as described for the -.CO ex +@CO{ex} command. -.SE -.KY ; -.IP "[count] ;" +@end table +@end deftypefn +@cindex ; +@deftypefn Command {[count]} {;} + Repeat the last character find -.LI count -times. +@LI{count}times. The last character find is one of the -.CO F , -.CO f , -.CO T +@CO{F}, +@CO{f}, +@CO{T} or -.CO t +@CO{t} commands. It is an error if a -.CO F , -.CO f , -.CO T +@CO{F}, +@CO{f}, +@CO{T} or -.CO t +@CO{t} command has not been performed yet. -.sp +@sp 1 The -.CO ; +@CO{;} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the searched-for character for the -.CO F +@CO{F} and -.CO f +@CO{f} commands, before the character for the -.CO t +@CO{t} command and after the character for the -.CO T +@CO{T} command. -.SP Options: +@item Options: None. -.SE -.KY < -.IP "[count] < motion" -.KY > -.Ip "[count] > motion" +@end table +@end deftypefn +@cindex < +@deftypefn Command {[count]} {< motion} + +@cindex > +@deftypefnx Command {[count]} {>} {motion} Shift lines left or right. Shift the number of lines in the region specified by the -.LI count -and -.LI motion -left (for the -.CO < +@LI{count}and +@LI{motion}left (for the +@CO{<} command) or right (for the -.CO > +@CO{>} command) by the number of columns specified by the -.OP shiftwidth +@OP{shiftwidth} option. Only whitespace characters are deleted when shifting left. Once the first character in the line no longer contains a whitespace character, the command will succeed, but the line will not be modified. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP shiftwidth +@OP{shiftwidth} option. -.SE -.KY @ -.IP "@ buffer" +@end table +@end deftypefn +@cindex @@ +@deftypefn Command {} {@@} {buffer} + Execute a named buffer. Execute the named buffer as -.CO vi +@CO{vi} commands. The buffer may include -.CO ex +@CO{ex} commands, too, but they must be expressed as a -.CO : +@CO{:} command. If the buffer is line oriented, -.LI -characters are logically appended to each line of the buffer. +@LI{}characters are logically appended to each line of the buffer. If the buffer is character oriented, -.LI -characters are logically appended to all but the last line in the buffer. -.sp +@LI{}characters are logically appended to all but the last line in the buffer. +@sp 1 If the buffer name is -.QT @ , +@QT{@@}, or -.QT * , +@QT{*}, then the last buffer executed shall be used. It is an error to specify -.QT @@ +@QT{@@@@} or -.QT @* +@QT{@@*} if there were no previous buffer executions. The text of a buffer may contain a -.CO @ +@CO{@@} command, and it is possible to create infinite loops in this manner. (The -.LI -character may be used to interrupt the loop.) -.SS -.SP Line: +@LI{}character may be used to interrupt the loop.) +@table @asis +@item Line: The current line is set as described for the command(s). -.SP Column: +@item Column: The current column is set as described for the command(s). -.SP Options: +@item Options: None. -.SE -.KY A -.IP "[count] A" +@end table +@end deftypefn +@cindex A +@deftypefn Command {[count]} {A} + Enter input mode, appending the text after the end of the line. If -.LI count -is specified, the text is repeatedly input -.LI "count - 1" -more times after input mode is exited. -.SS -.SP Line: +@LI{count}is specified, the text is repeatedly input +@LI{count - 1}more times after input mode is exited. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY B -.IP "[count] B" +@end table +@end deftypefn +@cindex B +@deftypefn Command {[count]} {B} + Move backward -.LI count -bigwords. +@LI{count}bigwords. Move the cursor backward to the beginning of a bigword by repeating the following algorithm: if the current position is at the beginning of a bigword or the character at the current position cannot be part of a bigword, @@ -1665,67 +1689,70 @@ Otherwise, move to the first character of the bigword at the current position. If no preceding bigword exists on the current line, move to the first character of the last bigword on the first preceding line that contains a bigword. -.sp +@sp 1 The -.CO B +@CO{B} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the word selected. -.SP Column: +@item Column: Set to the first character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY C -.IP "[buffer] [count] C" +@end table +@end deftypefn +@cindex C +@deftypefn Command {[buffer]} {[count] C} + Change text from the current position to the end-of-line. If -.LI count -is specified, the input text replaces from the current position to +@LI{count}is specified, the input text replaces from the current position to the end-of-line, plus -.LI "count - 1" -subsequent lines. -.SS -.SP Line: +@LI{count - 1}subsequent lines. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY D -.IP "[buffer] D" +@end table +@end deftypefn +@cindex D +@deftypefn Command {[buffer]} {D} + Delete text from the current position to the end-of-line. -.sp +@sp 1 It is not an error to execute the -.CO D +@CO{D} command on an empty line. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the character before the current character, or, column 1 if the cursor was on column 1. -.SP Options: +@item Options: None. -.SE -.KY E -.IP "[count] E" +@end table +@end deftypefn +@cindex E +@deftypefn Command {[count]} {E} + Move forward -.LI count -end-of-bigwords. +@LI{count}end-of-bigwords. Move the cursor forward to the end of a bigword by repeating the following algorithm: if the current position is the end of a bigword or the character at that position cannot be part of a bigword, @@ -1735,357 +1762,368 @@ position. If no succeeding bigword exists on the current line, move to the last character of the first bigword on the next following line that contains a bigword. -.sp +@sp 1 The -.CO E +@CO{E} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the word selected. -.SP Column: +@item Column: Set to the last character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY F -.IP "[count] F " +@end table +@end deftypefn +@cindex F +@deftypefn Command {[count]} {F} {} + Search -.LI count -times backward through the current line for -.LI . -.sp +@LI{count}times backward through the current line for +@LI{}. +@sp 1 The -.CO F +@CO{F} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the searched-for character. -.SP Options: +@item Options: None. -.SE -.KY G -.IP "[count] G" +@end table +@end deftypefn +@cindex G +@deftypefn Command {[count]} {G} + Move to line -.LI count , +@LI{count}, or the last line of the file if -.LI count -not specified. -.sp +@LI{count}not specified. +@sp 1 The -.CO G +@CO{G} command is an absolute movement. The -.CO \&G +@CO{G} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to -.LI count , +@LI{count}, if specified, otherwise, the last line. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY H -.IP "[count] H" +@end table +@end deftypefn +@cindex H +@deftypefn Command {[count]} {H} + Move to the screen line -.LI "count - 1" -lines below the top of the screen. -.sp +@LI{count - 1}lines below the top of the screen. +@sp 1 The -.CO H +@CO{H} command is an absolute movement. The -.CO H +@CO{H} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line -.LI "count - 1" -lines below the top of the screen. -.SP Column: +@LI{count - 1}lines below the top of the screen. +@item Column: Set to the first nonblank character of the -.i screen +@emph{screen} line. -.SP Options: +@item Options: None. -.SE -.KY I -.IP "[count] I" +@end table +@end deftypefn +@cindex I +@deftypefn Command {[count]} {I} + Enter input mode, inserting the text at the beginning of the line. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.SS -.SP Line: +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: None. -.SE -.KY J -.IP "[count] J" +@end table +@end deftypefn +@cindex J +@deftypefn Command {[count]} {J} + Join lines. If -.LI count -is specified, -.LI count -lines are joined; a minimum of two lines are always joined, +@LI{count}is specified, +@LI{count}lines are joined; a minimum of two lines are always joined, regardless of the value of -.LI count . -.sp +@LI{count}. +@sp 1 If the current line ends with a whitespace character, all whitespace is stripped from the next line. Otherwise, if the next line starts with a open parenthesis -.PQ ( +@PQ{(} do nothing. Otherwise, if the current line ends with a question mark -.PQ ? , +@PQ{?}, period -.PQ \&. +@PQ{.} or exclamation point -.PQ ! , +@PQ{!}, insert two spaces. Otherwise, insert a single space. -.sp +@sp 1 It is not an error to join lines past the end of the file, i.e. lines that do not exist. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the character after the last character of the next-to-last joined line. -.SP Options: +@item Options: None. -.SE -.KY L -.IP "[count] L" +@end table +@end deftypefn +@cindex L +@deftypefn Command {[count]} {L} + Move to the screen line -.LI "count - 1" -lines above the bottom of the screen. -.sp +@LI{count - 1}lines above the bottom of the screen. +@sp 1 The -.CO L +@CO{L} command is an absolute movement. The -.CO L +@CO{L} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line -.LI "count - 1" -lines above the bottom of the screen. -.SP Column: +@LI{count - 1}lines above the bottom of the screen. +@item Column: Set to the first nonblank character of the -.i screen +@emph{screen} line. -.SP Options: +@item Options: None. -.SE -.KY M -.IP " M" +@end table +@end deftypefn +@cindex M +@deftypefn Command {} {M} + Move to the screen line in the middle of the screen. -.sp +@sp 1 The -.CO M +@CO{M} command is an absolute movement. The -.CO M +@CO{M} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.sp +@sp 1 Historically, any -.LI count -specified to the -.CO M +@LI{count}specified to the +@CO{M} command was ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the line in the middle of the screen. -.SP Column: +@item Column: Set to the first nonblank character of the -.i screen +@emph{screen} line. -.SP Options: +@item Options: None. -.SE -.KY O -.IP "[count] O" +@end table +@end deftypefn +@cindex O +@deftypefn Command {[count]} {O} + Enter input mode, appending text in a new line above the current line. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.sp +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@sp 1 Historically, any -.LI count -specified to the -.CO O +@LI{count}specified to the +@CO{O} command was ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY P -.IP "[buffer] P" +@end table +@end deftypefn +@cindex P +@deftypefn Command {[buffer]} {P} + Insert text from a buffer. Text from the buffer (the unnamed buffer by default) is inserted before the current column or, if the buffer is line oriented, before the current line. -.SS -.SP Line: +@table @asis +@item Line: Set to the lowest numbered line insert, if the buffer is line oriented, otherwise unchanged. -.SP Column: +@item Column: Set to the first nonblank character of the appended text, if the buffer is line oriented, otherwise, the last character of the appended text. -.SP Options: +@item Options: None. -.SE -.KY Q -.IP "Q" +@end table +@end deftypefn +@cindex Q +@deftypefn Command {} {Q} + Exit -.CO vi +@CO{vi} (or visual) mode and switch to -.CO ex +@CO{ex} mode. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: No longer relevant. -.SP Options: +@item Options: None. -.SE -.KY R -.IP "[count] R" +@end table +@end deftypefn +@cindex R +@deftypefn Command {[count]} {R} + Enter input mode, replacing the characters in the current line. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.sp +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@sp 1 If the end of the current line is reached, no more characters are replaced and any further characters input are appended to the line. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY S -.IP "[buffer] [count] S" +@end table +@end deftypefn +@cindex S +@deftypefn Command {[buffer] [count]} {S} + Substitute -.LI count -lines. -.SS -.SP Line: +@LI{count}lines. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY T -.IP "[count] T " +@end table +@end deftypefn +@cindex T +@deftypefn Command {[count]} {T} {} + Search backward, -.LI count -times, +@LI{count}times, through the current line for the character -.i after +@emph{after} the specified -.LI . -.sp +@LI{}. +@sp 1 The -.CO T +@CO{T} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the character -.i after +@emph{after} the searched-for character. -.SP Options: +@item Options: None. -.SE -.KY U -.IP "U" +@end table +@end deftypefn +@cindex U +@deftypefn Command {} {U} + Restore the current line to its state before the cursor last moved to it. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: The first character in the line. -.SP Options: +@item Options: None. -.SE -.KY W -.IP "[count] W" +@end table +@end deftypefn +@cindex W +@deftypefn Command {[count]} {W} + Move forward -.LI count -bigwords. +@LI{count}bigwords. Move the cursor forward to the beginning of a bigword by repeating the following algorithm: if the current position is within a bigword or the character at that position cannot be part of a bigword, move to the first @@ -2093,219 +2131,227 @@ character of the next bigword. If no subsequent bigword exists on the current line, move to the first character of the first bigword on the first following line that contains a bigword. -.sp +@sp 1 The -.CO W +@CO{W} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: The line containing the word selected. -.SP Column: +@item Column: The first character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY X -.IP "[buffer] [count] X" +@end table +@end deftypefn +@cindex X +@deftypefn Command {[buffer] [count]} {X} + Delete -.LI count -characters before the cursor. +@LI{count}characters before the cursor. If the number of characters to be deleted is greater than or equal to the number of characters to the beginning of the line, all of the characters before the current cursor position, to the beginning of the line, are deleted. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the current character minus -.LI count , +@LI{count}, or the first character if count is greater than the number of characters in the line before the cursor. -.SP Options: +@item Options: None. -.SE -.KY Y -.IP "[buffer] [count] Y" +@end table +@end deftypefn +@cindex Y +@deftypefn Command {[buffer] [count]} {Y} + Copy (or -.QQ yank ) -.LI count -lines into the specified buffer. -.SS -.SP Line: +@QQ{yank}) +@LI{count}lines into the specified buffer. +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY ZZ -.IP "ZZ" +@end table +@end deftypefn +@cindex ZZ +@deftypefn Command {} {ZZ} + Write the file and exit -.CO vi . +@CO{vi}. The file is only written if it has been modified since the last complete write of the file to any file. -.sp +@sp 1 The -.CO ZZ +@CO{ZZ} command will exit the editor after writing the file, if there are no further files to edit. Entering two -.QQ quit +@QQ{quit} commands (i.e. -.CO wq , -.CO quit , -.CO xit +@CO{wq}, +@CO{quit}, +@CO{xit} or -.CO ZZ ) +@CO{ZZ}) in a row will override this check and the editor will exit, ignoring any files that have not yet been edited. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY [[ -.IP "[count] [[" +@end table +@end deftypefn +@cindex [[ +@deftypefn Command {[count]} {[[} + Back up -.LI count -section boundaries. -.sp +@LI{count}section boundaries. +@sp 1 The -.CO [[ +@CO{[[} command is an absolute movement. The -.CO [[ +@CO{[[} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting position is column 0, in which case it is line oriented. -.sp +@sp 1 It is an error if the movement is past the beginning of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the previous line that is -.LI count -section boundaries back, +@LI{count}section boundaries back, or the first line of the file if no more section boundaries exist preceding the current line. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP sections +@OP{sections} option. -.SE -.KY ]] -.IP "[count] ]]" +@end table +@end deftypefn +@cindex ]] +@deftypefn Command {[count]} {]]} + Move forward -.LI count -section boundaries. -.sp +@LI{count}section boundaries. +@sp 1 The -.CO ]] +@CO{]]} command is an absolute movement. The -.CO ]] +@CO{]]} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting position is column 0, in which case it is line oriented. -.sp +@sp 1 It is an error if the movement is past the end of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the line that is -.LI count -section boundaries forward, +@LI{count}section boundaries forward, or to the last line of the file if no more section boundaries exist following the current line. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP sections +@OP{sections} option. -.SE -.KY ^ -.IP "\&^" +@end table +@end deftypefn +@cindex ^ +@deftypefn Command {} {^} + Move to first nonblank character on the current line. -.sp +@sp 1 The -.CO ^ +@CO{^} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the first nonblank character of the current line. -.SP Options: +@item Options: None. -.SE -.KY _ -.IP "[count] _" +@end table +@end deftypefn +@cindex _ +@deftypefn Command {[count]} {_} + Move down -.LI "count - 1" -lines, to the first nonblank character. +@LI{count - 1}lines, to the first nonblank character. The -.CO _ +@CO{_} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is line oriented. -.sp +@sp 1 It is not an error to execute the -.CO _ +@CO{_} command when the cursor is on the first character in the line. -.SS -.SP Line: +@table @asis +@item Line: The current line plus -.LI "count - 1" . -.SP Column: +@LI{count - 1}. +@item Column: The first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY a -.IP "[count] a" +@end table +@end deftypefn +@cindex a +@deftypefn Command {[count]} {a} + Enter input mode, appending the text after the cursor. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.SS -.SP Line: +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY b -.IP "[count] b" +@end table +@end deftypefn +@cindex b +@deftypefn Command {[count]} {b} + Move backward -.LI count -words. +@LI{count}words. Move the cursor backward to the beginning of a word by repeating the following algorithm: if the current position is at the beginning of a word, move to the first character of the preceding word. @@ -2314,773 +2360,785 @@ at the current position. If no preceding word exists on the current line, move to the first character of the last word on the first preceding line that contains a word. -.sp +@sp 1 The -.CO b +@CO{b} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the word selected. -.SP Column: +@item Column: Set to the first character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY c -.IP "[buffer] [count] c motion" +@end table +@end deftypefn +@cindex c +@deftypefn Command {[buffer] [count]} {c} {motion} + Change the region of text specified by the -.LI count -and -.LI motion . +@LI{count}and +@LI{motion}. If only part of a single line is affected, then the last character being changed is marked with a -.QT $ . +@QT{$}. Otherwise, the region of text is deleted, and input mode is entered. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY d -.IP "[buffer] [count] d motion" +@end table +@end deftypefn +@cindex d +@deftypefn Command {[buffer] [count]} {d} {motion} + Delete the region of text specified by the -.LI count -and -.LI motion . -.SS -.SP Line: +@LI{count}and +@LI{motion}. +@table @asis +@item Line: Set to the line where the region starts. -.SP Column: +@item Column: Set to the first character in the line after the last character in the region. If no such character exists, set to the last character before the region. -.SP Options: +@item Options: None. -.SE -.KY e -.IP "[count] e" +@end table +@end deftypefn +@cindex e +@deftypefn Command {[count]} {e} + Move forward -.LI count -end-of-words. +@LI{count}end-of-words. Move the cursor forward to the end of a word by repeating the following algorithm: if the current position is the end of a word, move to the last character of the following word. Otherwise, move to the last character of the word at the current position. If no succeeding word exists on the current line, move to the last character of the first word on the next following line that contains a word. -.sp +@sp 1 The -.CO e +@CO{e} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the word selected. -.SP Column: +@item Column: Set to the last character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY f -.IP "[count] f " +@end table +@end deftypefn +@cindex f +@deftypefn Command {[count]} {f} {} + Search forward, -.LI count -times, through the rest of the current line for -.LI . -.sp +@LI{count}times, through the rest of the current line for +@LI{}. +@sp 1 The -.CO f +@CO{f} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the searched-for character. -.SP Options: +@item Options: None. -.SE -.KY i -.IP "[count] i" +@end table +@end deftypefn +@cindex i +@deftypefn Command {[count]} {i} + Enter input mode, inserting the text before the cursor. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.SS -.SP Line: +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY m -.IP "m " +@end table +@end deftypefn +@cindex m +@deftypefn Command {} {m} {} + Save the current context (line and column) as -.LI . +@LI{}. The exact position is referred to by -.QT ` . +@QT{`}. The line is referred to by -.QT ' . -.sp +@QT{'}. +@sp 1 Historically, -.LI -was restricted to lower-case letters. -.CO Nvi +@LI{}was restricted to lower-case letters. +@CO{Nvi} permits the use of any character. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged. -.SP Options: +@item Options: None. -.SE -.KY o -.IP "[count] o" +@end table +@end deftypefn +@cindex o +@deftypefn Command {[count]} {o} + Enter input mode, appending text in a new line under the current line. If -.LI count -is specified, the text input is repeatedly input -.LI "count - 1" -more times. -.sp +@LI{count}is specified, the text input is repeatedly input +@LI{count - 1}more times. +@sp 1 Historically, any -.LI count -specified to the -.CO o +@LI{count}specified to the +@CO{o} command was ignored. -.SS -.SP Line: +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY p -.IP "[buffer] p" +@end table +@end deftypefn +@cindex p +@deftypefn Command {[buffer]} {p} + Append text from a buffer. Text from the buffer (the unnamed buffer by default) is appended after the current column or, if the buffer is line oriented, after the current line. -.SS -.SP Line: +@table @asis +@item Line: Set to the first line appended, if the buffer is line oriented, otherwise unchanged. -.SP Column: +@item Column: Set to the first nonblank character of the appended text if the buffer is line oriented, otherwise, the last character of the appended text. -.SP Options: +@item Options: None. -.SE -.KY r -.IP "[count] r " +@end table +@end deftypefn +@cindex r +@deftypefn Command {[count]} {r} {} + Replace characters. The next -.LI count -characters in the line are replaced with -.LI . +@LI{count}characters in the line are replaced with +@LI{}. Replacing characters with -.LI -characters results in creating new, empty lines into the file. -.sp +@LI{}characters results in creating new, empty lines into the file. +@sp 1 If -.LI -is -.LI , +@LI{}is +@LI{}, the command is cancelled. -.SS -.SP Line: +@table @asis +@item Line: Unchanged unless the replacement character is a -.LI , +@LI{}, in which case it is set to the current line plus -.LI "count - 1" . -.SP Column: +@LI{count - 1}. +@item Column: Set to the last character replaced, unless the replacement character is a -.LI , +@LI{}, in which case the cursor is in column 1 of the last line inserted. -.SP Options: +@item Options: None. -.SE -.KY s -.IP "[buffer] [count] s" +@end table +@end deftypefn +@cindex s +@deftypefn Command {[buffer] [count]} {s} + Substitute -.LI count -characters in the current line starting with the current character. -.SS -.SP Line: +@LI{count}characters in the current line starting with the current character. +@table @asis +@item Line: Set to the last line upon which characters were entered. -.SP Column: +@item Column: Set to the last character entered. -.SP Options: +@item Options: Affected by the -.OP altwerase , -.OP autoindent , -.OP beautify , -.OP showmatch , -.OP ttywerase +@OP{altwerase}, +@OP{autoindent}, +@OP{beautify}, +@OP{showmatch}, +@OP{ttywerase} and -.OP wrapmargin +@OP{wrapmargin} options. -.SE -.KY t -.IP "[count] t " +@end table +@end deftypefn +@cindex t +@deftypefn Command {[count]} {t} {} + Search forward, -.LI count -times, through the current line for the character immediately -.i before -.LI . -.sp +@LI{count}times, through the current line for the character immediately +@emph{before} +@LI{}. +@sp 1 The -.CO t +@CO{t} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the character -.i before +@emph{before} the searched-for character. -.SP Options: +@item Options: None. -.SE -.KY u -.IP "u" +@end table +@end deftypefn +@cindex u +@deftypefn Command {} {u} + Undo the last change made to the file. If repeated, the -.CO u +@CO{u} command alternates between these two states, and is its own inverse. When used after an insert that inserted text on more than one line, the lines are saved in the numeric buffers. -.sp +@sp 1 The -.CO \&. +@CO{.} command, when used immediately after the -.CO u +@CO{u} command, causes the change log to be rolled forward or backward, depending on the action of the -.CO u +@CO{u} command. -.SS -.SP Line: +@table @asis +@item Line: Set to the position of the first line changed, if the reversal affects only one line or represents an addition or change; otherwise, the line preceding the deleted text. -.SP Column: +@item Column: Set to the cursor position before the change was made. -.SP Options: +@item Options: None. -.SE -.KY w -.IP "[count] w" +@end table +@end deftypefn +@cindex w +@deftypefn Command {[count]} {w} + Move forward -.LI count -words. +@LI{count}words. Move the cursor forward to the beginning of a word by repeating the following algorithm: if the current position is at the beginning of a word, move to the first character of the next word. If no subsequent word exists on the current line, move to the first character of the first word on the first following line that contains a word. -.sp +@sp 1 The -.CO w +@CO{w} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the word selected. -.SP Column: +@item Column: Set to the first character of the word selected. -.SP Options: +@item Options: None. -.SE -.KY x -.IP "[buffer] [count] x" +@end table +@end deftypefn +@cindex x +@deftypefn Command {[buffer] [count]} {x} + Delete -.LI count -characters. +@LI{count}characters. The deletion is at the current character position. If the number of characters to be deleted is greater than or equal to the number of characters to the end of the line, all of the characters from the current cursor position to the end of the line are deleted. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Unchanged unless the last character in the line is deleted and the cursor is not already on the first character in the line, in which case it is set to the previous character. -.SP Options: +@item Options: None. -.SE -.KY y -.IP "[buffer] [count] y motion" +@end table +@end deftypefn +@cindex y +@deftypefn Command {[buffer] [count]} y {motion} + Copy (or -.QQ yank ) +@QQ{yank}) the text region specified by the -.LI count -and -.LI motion , +@LI{count}and +@LI{motion}, into a buffer. -.SS -.SP Line: +@table @asis +@item Line: Unchanged, unless the region covers more than a single line, in which case it is set to the line where the region starts. -.SP Column: +@item Column: Unchanged, unless the region covers more than a single line, in which case it is set to the character were the region starts. -.SP Options: +@item Options: None. -.SE -.KY z -.IP "[count1] z [count2] type" +@end table +@end deftypefn +@cindex z +@deftypefn Command {[count1]} {z} {[count2] type} + Redraw the screen with a window -.LI count2 -lines long, with line -.LI count1 -placed as specified by the -.LI type -character. +@LI{count2}lines long, with line +@LI{count1}placed as specified by the +@LI{type}character. If -.LI count1 -is not specified, it defaults to the current line. +@LI{count1}is not specified, it defaults to the current line. If -.LI count2 -is not specified, it defaults to the current window size. -.sp +@LI{count2}is not specified, it defaults to the current window size. +@sp 1 The following -.LI type -characters may be used: -.SS -.SP + +@LI{type}characters may be used: +@table @asis +@item + If -.LI count1 -is specified, place the line -.LI count1 -at the top of the screen. +@LI{count1}is specified, place the line +@LI{count1}at the top of the screen. Otherwise, display the screen after the current screen, similarly to the -.CO +@CO{} command. -.SP +@item Place the line -.LI count1 -at the top of the screen. -.SP \&. +@LI{count1}at the top of the screen. +@item . Place the line -.LI count1 -in the center of the screen. -.SP \- +@LI{count1}in the center of the screen. +@item - Place the line -.LI count1 -at the bottom of the screen. -.SP ^ +@LI{count1}at the bottom of the screen. +@item ^ If -.LI count1 -is specified, place the line that is at the top of the screen +@LI{count1}is specified, place the line that is at the top of the screen when -.LI count1 -is at the bottom of the screen, at the bottom of the screen, +@LI{count1}is at the bottom of the screen, at the bottom of the screen, i.e. display the screen before the screen before -.LI count1 . +@LI{count1}. Otherwise, display the screen before the current screen, similarly to the -.CO +@CO{} command. -.SE -.SS -.SP Line: +@end table +@table @asis +@item Line: Set to -.LI count1 -unless -.LI count1 -is not specified and the -.LI type -character was either -.QT ^ +@LI{count1}unless +@LI{count1}is not specified and the +@LI{type}character was either +@QT{^} or -.QT + , +@QT{+}, in which case it is set to the line before the first line on the previous screen or the line after the last line on the previous screen, respectively. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: None. -.SE -.KY { -.IP "[count] {" +@end table +@end deftypefn +@cindex @{ +@deftypefn Command {[count]} @{ + Move backward -.LI count -paragraphs. -.sp +@LI{count}paragraphs. +@sp 1 The -.CO { +@strong{@{} command is an absolute movement. The -.CO { +@strong{@{} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting character is the first character on its line, in which case it is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the beginning of the previous paragraph. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP paragraph +@OP{paragraph} option. -.SE -.KY | -.IP "[count] |" +@end table +@end deftypefn +@cindex | +@deftypefn Command {[count]} {|} + Move to a specific -.i column +@emph{column} position on the current line. -.sp +@sp 1 The -.CO | +@CO{|} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented. It is an error to use the -.CO | +@CO{|} command as a motion component and for the cursor not to move. -.SS -.SP Line: +@table @asis +@item Line: Unchanged. -.SP Column: +@item Column: Set to the character occupying the column position identified by -.LI count , +@LI{count}, if the position exists in the line. If the column length of the current line is less than -.LI count , +@LI{count}, the cursor is moved to the last character in the line. -.SP Options: +@item Options: None. -.SE -.KY } -.IP "[count] }" +@end table +@end deftypefn +@cindex @} +@deftypefn Command {[count]} @} + Move forward -.LI count -paragraphs. -.sp +@LI{count}paragraphs. +@sp 1 The -.CO } +@strong{@}} command is an absolute movement. The -.CO } +@strong{@}} command may be used as the motion component of other -.CO vi +@CO{vi} commands, in which case any text copied into a buffer is character oriented, unless the starting character is at or before any nonblank characters in its line, in which case it is line oriented. -.SS -.SP Line: +@table @asis +@item Line: Set to the line containing the beginning of the next paragraph. -.SP Column: +@item Column: Set to the first nonblank character in the line. -.SP Options: +@item Options: Affected by the -.OP paragraph +@OP{paragraph} option. -.SE -.KY ~ -.IP "[count] ~" +@end table +@end deftypefn +@cindex ~ +@deftypefn Command {[count]} {~} + Reverse the case of the next -.LI count -character(s). +@LI{count}character(s). This is the historic semantic for the -.CO ~ +@CO{~} command and it is only in effect if the -.OP tildeop +@OP{tildeop} option is not set. -.sp +@sp 1 Lowercase alphabetic characters are changed to uppercase, and uppercase characters are changed to lowercase. No other characters are affected. -.sp +@sp 1 Historically, the -.CO ~ +@CO{~} command did not take an associated count, nor did it move past the end of the current line. As it had no associated motion it was difficult to change the case of large blocks of text. In -.CO nvi , +@CO{nvi}, if the cursor is on the last character of a line, and there are more lines in the file, the cursor moves to the next line. -.sp +@sp 1 It is not an error to specify a count larger than the number of characters between the cursor and the end of the file. -.SS -.SP Line: +@table @asis +@item Line: Set to the line of the character after -.LI count -characters, or, end of file. -.SP Column: +@LI{count}characters, or, end of file. +@item Column: Set to the character after -.LI count -characters, or, end-of-file. -.SP Options: +@LI{count}characters, or, end-of-file. +@item Options: Affected by the -.OP tildeop +@OP{tildeop} option. -.SE -.KY ~ -.IP "[count] ~ motion" +@end table +@end deftypefn +@cindex ~ +@deftypefn Command {[count]} {~} {motion} + Reverse the case of the characters in a text region specified by the -.LI count -and -.LI motion . +@LI{count}and +@LI{motion}. Only in effect if the -.OP tildeop +@OP{tildeop} option is set. -.sp +@sp 1 Lowercase characters are changed to uppercase, and uppercase characters are changed to lowercase. No other characters are affected. -.SS -.SP Line: +@table @asis +@item Line: Set to the line of the character after the last character in the region. -.SP Column: +@item Column: Set to the character after the last character in the region. -.SP Options: +@item Options: Affected by the -.OP tildeop +@OP{tildeop} option. -.SE -.KY -.IP "" +@end table +@end deftypefn +@cindex +@deftypefn Command {} {} + Interrupt the current operation. Many of the potentially long-running -.CO vi +@CO{vi} commands may be interrupted using the terminal interrupt character. These operations include searches, file reading and writing, filter operations and map character expansion. Interrupts are also enabled when running commands outside of -.CO vi . -.sp +@CO{vi}. +@sp 1 If the -.LI -character is used to interrupt while entering an -.CO ex +@LI{}character is used to interrupt while entering an +@CO{ex} command, the command is aborted, the cursor returns to its previous position, and -.CO vi +@CO{vi} remains in command mode. -.sp +@sp 1 Generally, if the -.LI -character is used to interrupt any +@LI{}character is used to interrupt any operation, any changes made before the interrupt are left in place. -.SS -.SP Line: +@table @asis +@item Line: Dependent on the operation being interrupted. -.SP Column: +@item Column: Dependent on the operation being interrupted. -.SP Options: +@item Options: None. -.SE -.SH 1 "Vi Text Input Commands" -.pp +@end table +@end deftypefn +@chapter Vi Text Input Commands + The following section describes the commands available in the text input mode of the -.CO vi +@CO{vi} editor. -.pp + Historically, -.CO vi +@CO{vi} implementations only permitted the characters inserted on the current line to be erased. In addition, only the -.LI -erase character and the -.QT 0 +@LI{}erase character and the +@QT{0} and -.QT ^ +@QT{^} erase strings could erase autoindent characters. (Autoindent characters include both the characters inserted automatically at the beginning of an input line as well as characters inserted using the -.LI -command.) +@LI{}command.) This implementation permits erasure to continue past the beginning of the current line, and back to where text input mode was entered. In addition, autoindent characters may be erased using the standard erase characters. For the line and word erase characters, reaching the autoindent characters forms a -.QQ soft +@QQ{soft} boundary, denoting the end of the current word or line erase. Repeating the word or line erase key will erase the autoindent characters. -.pp + Historically, -.CO vi +@CO{vi} always used -.LI -and -.LI -as character and word erase characters, respectively, regardless of +@LI{}and +@LI{}as character and word erase characters, respectively, regardless of the current terminal settings. This implementation accepts, in addition to these two characters, the current terminal characters for those operations. -.KY -.IP "" +@cindex +@deftypefn Input {} {} + If the first character of the input is a -.LI , +@LI{}, the previous input is replayed, as if just entered. -.KY -.IP "" +@end deftypefn +@cindex +@deftypefn Input {} {} + If the previous character on the line was an autoindent character, erase characters to move the cursor back to the column immediately after the previous (1-based) column which is a multiple of the -.OP shiftwidth +@OP{shiftwidth} edit option. This may result in any number of -.LI -and -.LI -characters preceding the cursor being changed. -.sp +@LI{}and +@LI{}characters preceding the cursor being changed. +@sp 1 Otherwise, if the -.OP autoindent +@OP{autoindent} option is set and the user is entering the first character in the line, -.LI -is ignored. +@LI{}is ignored. Otherwise, a literal -.LI -character is entered. -.KY ^ -.IP "^" +@LI{}character is entered. +@end deftypefn +@cindex ^ +@deftypefn Input {} {^} + If the previous character on the line was an autoindent character, erase all of the autoindent characters on the line. In addition, the autoindent level is reset to 0. -.KY 0 -.IP "0" +@end deftypefn +@cindex 0 +@deftypefn Input {} {0} + If the previous character on the line was an autoindent character, erase all of the autoindent characters on the line. The autoindent level is not altered. -.KY -.IP "" +@end deftypefn +@cindex +@deftypefn Input {} {} + Insert sufficient -.LI -and -.LI -characters to move the cursor forward to the column immediately +@LI{}and +@LI{}characters to move the cursor forward to the column immediately after the next (1-based) column which is a multiple of the -.OP shiftwidth +@OP{shiftwidth} edit option. This may result in any number of -.LI -and -.LI -characters preceding the cursor being changed. -.sp +@LI{}and +@LI{}characters preceding the cursor being changed. +@sp 1 Historically, -.CO vi +@CO{vi} did not permit the -.LI -command to be used unless the cursor was at the first column of a new +@LI{}command to be used unless the cursor was at the first column of a new line or it was preceded only by autoindent characters. -.CO Nvi +@CO{Nvi} permits it to be used at any time during insert mode. -.KY -.IP -.KY -.Ip +@end deftypefn +@cindex +@deftypefn Input {} {} + +@cindex +@deftypefnx Input {} {} Erase the last character. -.KY "" -.IP "" +@end deftypefn +@cindex "" +@deftypefn Input {} {} + Quote the next character. The next character will not be mapped (see the -.CO map +@CO{map} command for more information) or interpreted specially. A carat -.PQ ^ +@PQ{^} character will be displayed immediately as a placeholder, but will be replaced by the next character. -.KY -.IP +@end deftypefn +@cindex +@deftypefn Input {} {} + If on the colon command line, and the -.OP filec +@OP{filec} edit option is set, behave as described for that option. Otherwise, if on the colon command line, execute the command. Otherwise, if not on the colon command line, resolve all text input into the file, and return to command mode. -.KY "" -.IP "" +@end deftypefn +@cindex "" +@deftypefn Input {} {} + Erase the current line. -.KY "" -.IP "" -.KY "" -.Ip "" +@end deftypefn +@cindex "" +@deftypefn Input {} {} + +@cindex "" +@deftypefnx Input {} {} Erase the last word. The definition of word is dependent on the -.OP altwerase +@OP{altwerase} and -.OP ttywerase +@OP{ttywerase} options. -.KY "" -.IP "[0-9A-Fa-f]+" +@end deftypefn +@cindex "" +@deftypefn Input {} {[0-9A-Fa-f]+} + Insert a character with the specified hexadecimal value into the text. The value is delimited by any non-hexadecimal character or the input of the maximum number of characters that can be translated into a single character value. -.KY -.IP "" +@end deftypefn +@cindex +@deftypefn Input {} {} + Interrupt text input mode, returning to command mode. If the -.LI -character is used to interrupt inserting text into the file, +@LI{}character is used to interrupt inserting text into the file, it is as if the -.LI -character was used; all text input up to the interruption is +@LI{}character was used; all text input up to the interruption is resolved into the file. +@end deftypefn diff --git a/docs/vi.ref/vi.ref b/docs/vi.ref/vi.texi similarity index 59% rename from docs/vi.ref/vi.ref rename to docs/vi.ref/vi.texi index c25f0e50..5c47082c 100644 --- a/docs/vi.ref/vi.ref +++ b/docs/vi.ref/vi.texi @@ -1,94 +1,87 @@ -.\" Copyright (c) 1994 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 1994, 1995, 1996 -.\" Keith Bostic. All rights reserved. -.\" -.\" This document may not be republished without written permission from -.\" Keith Bostic. -.\" -.\" See the LICENSE file for redistribution information. -.\" -.\" $Id: vi.ref,v 8.90 2001/01/28 13:48:00 skimo Exp $ (Berkeley) $Date: 2001/01/28 13:48:00 $ -.\" -.\" -.so ref.so -.tp -.(l C -.ps 12 -.ft B -Vi/Ex Reference Manual -.ft -.ps -.sp -.i "Keith Bostic" -.sp -Computer Science Division -Department of Electrical Engineering and Computer Science -University of California, Berkeley -Berkeley, California 94720 -.sp 1 -\*(td -.)l -.sp 3 -.(l C -.i Abstract -.)l -.(q -.pp +\input texinfo +@setfilename vi.ref.info + +@setchapternewpage off +@syncodeindex fn cp + +@comment Copyright (c) 1994 +@comment The Regents of the University of California. All rights reserved. +@comment Copyright (c) 1994, 1995, 1996 +@comment Keith Bostic. All rights reserved. +@comment +@comment This document may not be republished without written permission from +@comment Keith Bostic. +@comment +@comment See the LICENSE file for redistribution information. +@comment +@comment $Id: vi.texi,v 8.1 2001/08/18 20:43:50 skimo Exp $ (Berkeley) $Date: 2001/08/18 20:43:50 $ +@comment +@comment +@include ref.texi +@titlepage +@center @titlefont{Vi/Ex Reference Manual} +@sp 1 +@center @emph{Keith Bostic} +@sp 1 +@center Computer Science Division +@center Department of Electrical Engineering and Computer Science +@center University of California, Berkeley +@center Berkeley, California 94720 +@sp 1 +@center @emph{Sven Verdoolaege} +@sp 1 +@center @today +@sp 3 +@center @emph{Abstract} + This document is the reference guide for the 4.4BSD implementations of -.EV nex nvi , +@EV{nex,nvi}, which are implementations of the historic Berkeley -.EV ex vi +@EV{ex,vi} editors. -.)q -.sp 3 -.lp -Copyright (c) 1991, 1992, 1993, 1994 -.ti +5 -The Regents of the University of California. All Rights Reserved. -.lp -Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996 -.ti +5 -Keith Bostic. All Rights Reserved. -.bp 2 -.(l C -.i Acknowledgements -.)l -.sp -.(q -.pp +@vskip 0pt plus 1filll +Copyright @copyright{} 1991, 1992, 1993, 1994@* +@hskip 2cm The Regents of the University of California. All Rights Reserved.@* +Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996@* +@hskip 2cm Keith Bostic. All Rights Reserved.@* +Copyright @copyright{} 2001@* +@hskip 2cm Sven Verdoolaege. All Rights Reserved.@* +@page +@center@emph{Acknowledgements} +@sp 1 + Bruce Englar encouraged the early development of the historic -.EV ex vi +@EV{ex,vi} editor. Peter Kessler helped bring sanity to version 2's command layout. Bill Joy wrote versions 1 and 2.0 through 2.7, and created the framework that users see in the present editor. Mark Horton added macros and other features and made -.EV ex vi +@EV{ex,vi} work on a large number of terminals and Unix systems. -.pp -.CO Nvi -is originally derived from software contributed to the University of + +@CO{Nvi} + is originally derived from software contributed to the University of California, Berkeley by Steve Kirkendall, the author of the -.CO vi -clone -.CO elvis . -.pp +@CO{vi} + clone +@CO{elvis}. + IEEE Standard Portable Operating System Interface for Computer Environments (POSIX) 1003.2 style Regular Expression support was done by Henry Spencer. -.pp + The curses library was originally done by Ken Arnold. Scrolling and reworking for -.CO nvi -was done by Elan Amir. -.pp +@CO{nvi} + was done by Elan Amir. + George Neville-Neil added the Tcl interpreter, and Sven Verdoolaege added the Perl interpreter. -.pp + Rob Mayoff added Cscope support. -.pp + The Institute of Electrical and Electronics Engineers has given us permission to reprint portions of their documentation. Portions of this document are reprinted and reproduced from @@ -96,434 +89,435 @@ IEEE Std 1003.2-1992, IEEE Standard Portable Operating System Interface for Computer Environments (POSIX), copyright 1992 by the Institute of Electrical and Electronics Engineers, Inc. -.pp + The financial support of UUNET Communications Services is gratefully acknowledged. -.)q -.sy echo -n >index -.oh 'Vi/Ex Reference''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference' -.bp 4 -.SH 1 Description -.pp -.CO Vi -is a screen oriented text editor. -.CO Ex -is a line-oriented text editor. -.CO Ex -and -.CO vi -are different interfaces to the same program, +@end titlepage +@contents +@chapter Description + +@CO{Vi} + is a screen oriented text editor. +@CO{Ex} + is a line-oriented text editor. +@CO{Ex} + and +@CO{vi} + are different interfaces to the same program, and it is possible to switch back and forth during an edit session. -.CO View -is the equivalent of using the -.b \-R +@CO{View} + is the equivalent of using the +@strong{-R} (read-only) option of -.CO vi . -.pp +@CO{vi} . + This reference manual is the one provided with the -.EV nex nvi +@EV{nex,nvi} versions of the -.EV ex vi +@EV{ex,vi} text editors. -.EV Nex nvi +@EV{Nex,nvi} are intended as bug-for-bug compatible replacements for the original Fourth Berkeley Software Distribution (4BSD) -.EV ex vi +@EV{ex,vi} programs. This reference manual is accompanied by a traditional-style manual page. That manual page describes the functionality found in -.EV ex vi +@EV{ex,vi} in far less detail than the description here. In addition, it describes the system interface to -.EV ex vi , +@EV{ex,vi}, e.g. command line options, session recovery, signals, environmental variables, and similar things. -.pp + This reference is intended for users already familiar with -.EV ex vi . +@EV{ex,vi}. Anyone else should almost certainly read a good tutorial on the editor first. If you are in an unfamiliar environment, and you absolutely have to get work done immediately, see the section entitled -.QB "Fast Startup" +@QB{Fast Startup} in the manual page. It is probably enough to get you started. -.pp + There are a few features in -.EV nex nvi +@EV{nex,nvi} that are not found in historic versions of -.EV ex vi . +@EV{ex,vi}. Some of the more interesting of those features are briefly described in the next section, entitled -.QB "Additional Features" . +@QB{Additional Features} . For the rest of this document, -.EV nex nvi +@EV{nex,nvi} is used only when it is necessary to distinguish it from the historic implementations of -.EV ex vi . -.pp +@EV{ex,vi}. + Future versions of this software will be periodically made available by anonymous ftp, and can be retrieved from -.LI ftp.cs.berkeley.edu , +@LI{ftp.cs.berkeley.edu}, in the directory -.LI ucb/4bsd . -.SH 1 "Additional Features in Nex/Nvi" -.pp +@LI{ucb/4bsd}. +@chapter Additional Features in Nex/Nvi + There are a few features in -.EV nex nvi +@EV{nex,nvi} that are not found in historic versions of -.EV ex vi . +@EV{ex,vi}. Some of the more interesting of these are as follows: -.IP "8-bit clean data, large lines, files" -.EV Nex nvi +@itemize @bullet +@IP{8-bit clean data, large lines, files} + +@EV{Nex,nvi} will edit any format file. Line lengths are limited by available memory, and file sizes are limited by available disk space. The -.CO vi -text input mode command -.CO -can insert any possible character value into the text. -.IP "Background and foreground screens" +@CO{vi} + text input mode command +@CO{} + can insert any possible character value into the text. +@IP{Background and foreground screens} + The -.CO bg -command backgrounds the current screen, and the -.CO fg -command foregrounds backgrounded screens. +@CO{bg} + command backgrounds the current screen, and the +@CO{fg} + command foregrounds backgrounded screens. The -.CO display -command can be used to list the background screens. -.IP "Command Editing" +@CO{display} + command can be used to list the background screens. +@IP{Command Editing} + You can enter a normal editing window on the collected commands that you've entered on the -.CO vi -colon command-line, +@CO{vi} + colon command-line, and then modify and/or execute the commands. See the -.OP cedit +@OP{cedit} edit option for more information. -.IP "Displays" +@IP{Displays} + The -.CO display -command can be used to display the current buffers, the backgrounded +@CO{display} + command can be used to display the current buffers, the backgrounded screens, and the tags stack. -.IP "Extended Regular Expressions" +@IP{Extended Regular Expressions} + The -.CO extended -option causes Regular Expressions to be interpreted as as Extended -Regular Expressions, (i.e. \fIegrep\fP(1) style Regular Expressions). -.IP "File Name Completion" +@CO{extended} + option causes Regular Expressions to be interpreted as as Extended +Regular Expressions, (i.e.@: @command{egrep}(1) style Regular Expressions). +@IP{File Name Completion} + It is possible to do file name completion and file name displays when entering commands on the -.CO vi -colon command-line. +@CO{vi} + colon command-line. See the -.OP filec +@OP{filec} option for more information. -.IP "Infinite undo" +@IP{Infinite undo} + Changes made during an edit session may be rolled backward and forward. A -.CO \&. -command immediately after a -.CO u -command continues either forward or backward depending on whether the -.CO u -command was an undo or a redo. -.IP "Left-right scrolling" +@CO{.} + command immediately after a +@CO{u} + command continues either forward or backward depending on whether the +@CO{u} + command was an undo or a redo. +@IP{Left-right scrolling} + The -.CO leftright -option causes -.CO nvi -to do left-right screen scrolling, instead of the traditional -.CO vi -line wrapping. -.IP "Message Catalogs" +@CO{leftright} + option causes +@CO{nvi} + to do left-right screen scrolling, instead of the traditional +@CO{vi} + line wrapping. +@IP{Message Catalogs} + It is possible to display informational and error messages in different languages by providing a catalog of messages. See the -.OP msgcat +@OP{msgcat} option and the file -.LI "catalog/README" -for more information. -.IP "Incrementing numbers" +@LI{catalog/README}for more information. +@IP{Incrementing numbers} + The -.CO \&# -command increments or decrements the number referenced by the cursor. -.IP "Previous file" +@CO{#} + command increments or decrements the number referenced by the cursor. +@IP{Previous file} + The -.CO previous -command edits the previous file from the argument list. -.IP "Scripting languages" +@CO{previous} + command edits the previous file from the argument list. +@IP{Scripting languages} + The -.CO ":pe[rl] cmd" , -.CO ":perld[o] cmd" +@CO{:pe[rl] cmd}, +@CO{:perld[o] cmd} and -.CO ":tc[l] cmd" +@CO{:tc[l] cmd} commands execute Perl and Tcl/Tk commands, respectively, on lines from the edit buffer. See the -.QB "Scripting Languages" +@QB{Scripting Languages} section and the specific commands for more information. -.\".IP "Shell screens" -.\"The -.\".CO ":sc[ript] [file ...]" -.\"command runs a shell in the screen. -.\"Editing is unchanged, with the exception that a \fC\fP -.\"enters the current line (stripped of any prompt) as input to the -.\"shell. -.IP "Split screens" +@comment @IP{Shell screens} + +@comment The +@comment @CO{:sc[ript] [file ...]} +@comment command runs a shell in the screen. +@comment Editing is unchanged, with the exception that a \fC\fP +@comment enters the current line (stripped of any prompt) as input to the +@comment shell. +@IP{Split screens} + The -.CO Edit , -.CO Ex , -.CO Next , -.CO Previous , -.CO Tag -and -.CO Visual -(in -.CO vi -mode) commands divide the screen into multiple editing regions and +@CO{Edit} , +@CO{Ex} , +@CO{Next} , +@CO{Previous} , +@CO{Tag} + and +@CO{Visual} + (in +@CO{vi} + mode) commands divide the screen into multiple editing regions and then perform their normal function in a new screen area. The -.CO -command rotates between the foreground screens. +@CO{} + command rotates between the foreground screens. The -.CO resize -command can be used to grow or shrink a particular screen. -.IP "Tag stacks" +@CO{resize} + command can be used to grow or shrink a particular screen. +@IP{Tag stacks} + Tags are now maintained in a stack. The -.CO -command returns to the previous tag location. +@CO{} + command returns to the previous tag location. The -.CO tagpop -command returns to the most recent tag location by default, or, +@CO{tagpop} + command returns to the most recent tag location by default, or, optionally to a specific tag number in the tag stack, or the most recent tag from a specified file. The -.CO display -command can be used to list the tags stack. +@CO{display} + command can be used to list the tags stack. The -.CO tagtop -command returns to the top of the tag stack. -.IP "Usage information" +@CO{tagtop} + command returns to the top of the tag stack. +@IP{Usage information} + The -.CO exusage -and -.CO viusage -commands provide usage information for all of the -.CO ex -and -.CO vi -commands by default, or, optionally, for a specific command or key. -.IP "Word search" +@CO{exusage} + and +@CO{viusage} + commands provide usage information for all of the +@CO{ex} + and +@CO{vi} + commands by default, or, optionally, for a specific command or key. +@IP{Word search} + The -.CO -command searches for the word referenced by the cursor. -.SH 1 "Startup Information" -.pp -.EV Ex vi +@CO{} + command searches for the word referenced by the cursor. +@end itemize +@chapter Startup Information + +@EV{Ex,vi} interprets one of two possible environmental variables and reads up to three of five possible files during startup. The variables and files are expected to contain -.CO ex -commands, not -.CO vi -commands. +@CO{ex} + commands, not +@CO{vi} + commands. In addition, they are interpreted -.i before +@emph{before} the file to be edited is read, and therefore many -.CO ex -commands may not be used. +@CO{ex} + commands may not be used. Generally, any command that requires output to the screen or that needs a file upon which to operate, will cause an error if included in a startup file or environmental variable. -.pp + Because the -.CO ex -command set supported by -.EV nex nvi +@CO{ex} + command set supported by +@EV{nex,nvi} is a superset of the command set supported by historical implementations of -.CO ex , -.EV nex nvi +@CO{ex} , +@EV{nex,nvi} can use the startup files created for the historical implementations, but the converse may not be true. -.pp + If the -.b \-s -(the historic \- option) +@strong{-s} +(the historic - option) is specified, or if standard input is redirected from a file, all environmental variables and startup files are ignored. -.pp + Otherwise, startup files and environmental variables are handled in the following order: -.np +@enumerate +@item The file -.LI /etc/vi.exrc -is read, +@LI{/etc/vi.exrc}is read, as long as it is owned by root or the effective user ID of the user. -.np +@item The environmental variable -.LI NEXINIT -(or the variable -.LI EXINIT , +@LI{NEXINIT}(or the variable +@LI{EXINIT}, if -.LI NEXINIT -is not set) is interpreted. -.np +@LI{NEXINIT}is not set) is interpreted. +@item If neither -.LI NEXINIT -or -.LI EXINIT -was set, and the -.LI HOME -environmental variable is set, the file -.LI $HOME/.nexrc -(or the file -.LI $HOME/.exrc , +@LI{NEXINIT}or +@LI{EXINIT}was set, and the +@LI{HOME}environmental variable is set, the file +@LI{$HOME/.nexrc}(or the file +@LI{$HOME/.exrc}, if -.LI $HOME/.nexrc -does not exist) is read, +@LI{$HOME/.nexrc}does not exist) is read, as long as the effective user ID of the user is root or is the same as the owner of the file. -.sp +@sp 1 When the $HOME directory is being used for both -.EV nex nvi +@EV{nex,nvi} and an historic implementation of -.EV ex vi , +@EV{ex,vi}, a possible solution is to put -.EV nex nvi +@EV{nex,nvi} specific commands in the -.LI \&.nexrc -file, along with a -.CO ":source $HOME/.exrc" +@LI{.nexrc}file, along with a +@CO{:source $HOME/.exrc} command to read in the commands common to both implementations. -.np +@item If the -.OP exrc +@OP{exrc} option was turned on by one of the previous startup information sources, the file -.LI \&.nexrc -(or the file -.LI \&.exrc , +@LI{.nexrc}(or the file +@LI{.exrc}, if -.LI \&.nexrc -does not exist) is read, as long as the effective user ID of the user +@LI{.nexrc}does not exist) is read, as long as the effective user ID of the user is the same as the owner of the file. -.pp +@end enumerate + No startup file is read if it is writable by anyone other than its owner. -.pp + It is not an error for any of the startup environmental variables or files not to exist. -.pp + Once all environmental variables are interpreted, and all startup files are read, the first file to be edited is read in (or a temporary file is created). Then, any commands specified using the -.b \-c +@strong{-c} option are executed, in the context of that file. -.SH 1 "Recovery" -.pp +@chapter Recovery + There is no recovery program for -.EV nex nvi , +@EV{nex,nvi}, nor does -.EV nex nvi +@EV{nex,nvi} run setuid. Recovery files are created readable and writable by the owner only. Users may recover any file which they can read, and the superuser may recover any edit session. -.pp + Edit sessions are backed by files in the directory named by the -.OP recdir +@OP{recdir} option (the directory -.LI /var/tmp/vi.recover -by default), and are named -.QC vi.XXXXXX , +@LI{/var/tmp/vi.recover}by default), and are named +@QC{vi.XXXXXX}, where -.QC XXXXXX +@QC{XXXXXX} is a number related to the process ID. When a file is first modified, a second recovery file containing an email message for the user is created, and is named -.QC recover.XXXXXX , +@QC{recover.XXXXXX}, where, again, -.QC XXXXXX +@QC{XXXXXX} is associated with the process ID. Both files are removed at the end of a normal edit session, but will remain if the edit session is abnormally terminated or the user runs the -.CO ex -.CO preserve -command. -.pp +@CO{ex} + @CO{preserve} + command. + The -.OP recdir +@OP{recdir} option may be set in either the user's or system's startup information, changing the recovery directory. (Note, however, that if a memory based file system is used as the backup directory, each system reboot will delete all of the recovery files! The same caution applies to directories such as -.LI /tmp -which are cleared of their contents by a system reboot, or -.LI /usr/tmp -which is periodically cleared of old files on many systems.) -.pp +@LI{/tmp}which are cleared of their contents by a system reboot, or +@LI{/usr/tmp}which is periodically cleared of old files on many systems.) + The recovery directory should be owned by root, or at least by a pseudo-user. In addition, if directory -.QQ sticky-bit +@QQ{sticky-bit} semantics are available, the directory should have the sticky-bit set so that files may only be removed by their owners. The recovery directory must be read, write, and executable by any user, -i.e. mode 1777. -.pp +i.e.@: mode 1777. + If the recovery directory does not exist, -.EV ex vi +@EV{ex,vi} will attempt to create it. This can result in the recovery directory being owned by a normal user, which means that that user will be able to remove other user's recovery and backup files. This is annoying, but is not a security issue as the user cannot otherwise access or modify the files. -.pp + The recovery file has all of the necessary information in it to enable the user to recover the edit session. In addition, it has all of the necessary email headers for -.XR sendmail 8 . +@XR{sendmail,8}. When the system is rebooted, all of the files in -.LI /var/tmp/vi.recover -named -.QC recover.XXXXXX +@LI{/var/tmp/vi.recover}named +@QC{recover.XXXXXX} should be sent to their owners, by email, using the -.b \-t +@strong{-t} option of -.CO sendmail -(or a similar mechanism in other mailers). +@CO{sendmail} + (or a similar mechanism in other mailers). If -.EV ex vi +@EV{ex,vi} receives a hangup (SIGHUP) signal, or the user executes the -.CO ex -.CO preserve -command, -.EV ex vi +@CO{ex} + @CO{preserve} + command, +@EV{ex,vi} will automatically email the recovery information to the user. -.pp + If your system does not have the -.CO sendmail -utility (or a mailer program which supports its interface) +@CO{sendmail} + utility (or a mailer program which supports its interface) the source file -.LI nvi/common/recover.c -will have to be modified to use your local mail delivery programs. +@LI{nvi/common/recover.c}will have to be modified to use your local mail delivery programs. Note, if -.EV nex nvi +@EV{nex,nvi} is changed to use another mailer, it is important to remember that the owner of the file given to the mailer is the -.EV nex nvi +@EV{nex,nvi} user, so nothing in the file should be trusted as it may have been modified in an effort to compromise the system. -.pp + Finally, the owner execute bit is set on backup files when they are created, and unset when they are first modified, e.g. backup files that have no associated email recovery file will have this bit set. @@ -531,161 +525,159 @@ that have no associated email recovery file will have this bit set. not yet have this bit set. This is due to the method in which the files are created.) Such files should be deleted when the system reboots. -.pp + A simple way to do this cleanup is to run the Bourne shell script -.CO recover , +@CO{recover} , from your -.LI /etc/rc.local -(or other system startup) file. +@LI{/etc/rc.local}(or other system startup) file. The script should work with the historic Bourne shell, a POSIX 1003.2 shell or the Korn shell. The -.CO recover -script is installed as part of the -.EV nex nvi +@CO{recover} + script is installed as part of the +@EV{nex,nvi} installation process. -.pp + Consult the manual page for details on recovering preserved or aborted editing sessions. -.SH 1 "Sizing the Screen" -.pp +@chapter Sizing the Screen + The size of the screen can be set in a number of ways. -.EV Ex vi +@EV{Ex,vi} takes the following steps until values are obtained for both the number of rows and number of columns in the screen. -.np +@enumerate +@item If the environmental variable -.LI LINES -exists, +@LI{LINES}exists, it is used to specify the number of rows in the screen. -.np +@item If the environmental variable -.LI COLUMNS -exists, +@LI{COLUMNS}exists, it is used to specify the number of columns in the screen. -.np +@item The TIOCGWINSZ -.XR ioctl 2 +@XR{ioctl,2} is attempted on the standard error file descriptor. -.np +@item The termcap entry (or terminfo entry on System V machines) is checked for the -.QQ li +@QQ{li} entry (rows) and the -.QQ co +@QQ{co} entry (columns). -.np +@item The number of rows is set to 24, and the number of columns is set to 80. -.pp +@end enumerate + If a window change size signal (SIGWINCH) is received, the new window size is retrieved using the TIOCGWINSZ -.XR ioctl 2 +@XR{ioctl,2} call, and all other information is ignored. -.SH 1 "Character Display" -.pp +@chapter Character Display + In both -.CO ex -and -.CO vi -printable characters as defined by -.XR isprint 3 +@CO{ex} + and +@CO{vi} + printable characters as defined by +@XR{isprint,3} are displayed using the local character set. -.pp + Non-printable characters, for which -.XR iscntrl 3 +@XR{iscntrl,3} returns true, and which are less than octal \e040, are displayed as the string -.QT ^ , +@QT{^}, where -.LI -is the character that is the original character's value offset from the -.QT @ +@LI{}is the character that is the original character's value offset from the +@QT{@@} character. For example, the octal character \e001 is displayed as -.QT ^A . +@QT{^A}. If -.XR iscntrl 3 +@XR{iscntrl,3} returns true for the octal character \e177, it is displayed as the string -.QT ^? . +@QT{^?}. All other characters are displayed as either hexadecimal values, in the form -.QT "0x ... 0x" , +@QT{0x ... 0x}, or as octal values, in the form -.QT "\e ... \e" . +@QT{\e ... \e}. The display of unknown characters is based on the value of the -.OP octal +@OP{octal} option. -.pp + In -.CO vi -command mode, the cursor is always positioned on the last column of +@CO{vi} + command mode, the cursor is always positioned on the last column of characters which take up more than one column on the screen. In -.CO vi -text input mode, the cursor is positioned on the first column of +@CO{vi} + text input mode, the cursor is positioned on the first column of characters which take up more than one column on the screen. -.SH 1 "Multiple Screens" -.pp -.CO Nvi -supports multiple screens by dividing the window into regions. +@chapter Multiple Screens + +@CO{Nvi} + supports multiple screens by dividing the window into regions. It also supports stacks of screens by permitting the user to change the set of screens that are currently displayed. -.pp + The -.CO Edit , -.CO Ex , -.CO Fg , -.CO Next , -.CO Previous , -.CO Tag -and -.CO Visual -(in -.CO vi -mode) +@CO{Edit} , +@CO{Ex} , +@CO{Fg} , +@CO{Next} , +@CO{Previous} , +@CO{Tag} + and +@CO{Visual} + (in +@CO{vi} + mode) commands divide the current screen into two regions of approximately equal size and then perform their usual action in a new screen area. If the cursor is in the lower half of the screen, the screen will split -up, i.e. the new screen will be above the old one. +up, i.e.@: the new screen will be above the old one. If the cursor is in the upper half of the screen, the new screen will be below the old one. -.pp + When more than one screen is editing a file, changes in any screen are reflected in all other screens editing the same file. Exiting a screen without saving any changes (or explicitly discarding them) is permitted until the last screen editing the file is exited, at which time the changes must be saved or discarded. -.pp + The -.CO resize -command permits resizing of individual screens. +@CO{resize} + command permits resizing of individual screens. Screens may be grown, shrunk or set to an absolute number of rows. -.pp + The -.CO ^W -command is used to switch between screens. +@CO{^W} + command is used to switch between screens. Each -.CO ^W -moves to the next lower screen in the window, or to the first screen +@CO{^W} + moves to the next lower screen in the window, or to the first screen in the window if there are no lower screens. -.pp + The -.CO bg -command -.QQ backgrounds +@CO{bg} + command +@QQ{backgrounds} the current screen. The screen disappears from the window, and the rows it occupied are taken over by a neighboring screen. It is an error to attempt to background the only screen in the window. -.pp + The -.CO "display screens" +@CO{display screens} command displays the names of the files associated with the current backgrounded screens in the window. -.pp + The -.CO "fg [file]" +@CO{fg [file]} command moves the specified screen from the list of backgrounded screens to the foreground. If no file argument is specified, the first screen on the list is @@ -693,91 +685,90 @@ foregrounded. By default, foregrounding consists of backgrounding the current screen, and replacing its space in the window with the foregrounded screen. -.pp -Capitalizing the first letter of the command, i.e. -.CO Fg , + +Capitalizing the first letter of the command, i.e.@: +@CO{Fg} , will foreground the backgrounded screen in a new screen instead of swapping it with the current screen. -.pp + If the last foregrounded screen in the window is exited, and there are backgrounded screens, the first screen on the list of backgrounded screens takes over the window. -.SH 1 "Tags, Tag Stacks, and Cscope" -.pp -.CO Nvi -supports the historic -.CO vi -tag command -.CO , +@chapter Tags, Tag Stacks, and Cscope + +@CO{Nvi} + supports the historic +@CO{vi} + tag command +@CO{} , and the historic -.CO ex -tag command -.CO tag . +@CO{ex} + tag command +@CO{tag} . These commands change the current file context to a new location, based on information found in the -.LI tags -files. +@LI{tags}files. If you are unfamiliar with these commands, you should review their description in the -.CO ex -and -.CO vi -commands section of this manual. +@CO{ex} + and +@CO{vi} + commands section of this manual. For additional information on tags files, see the discussion of the -.OP tags +@OP{tags} edit option and the system -.XR ctags 1 +@XR{ctags,1} manual page. -.pp + In addition, -.CO nvi -supports the notion of -.QQ "tags stacks" , +@CO{nvi} + supports the notion of +@QQ{tags stacks}, using the -.CO -command. +@CO{} + command. The -.CO -command returns the user to the previous context, i.e., +@CO{} + command returns the user to the previous context, i.e., the last place from which a -.CO -or -.CO "tag" +@CO{} + or +@CO{tag} command was entered. These three commands provide the basic functionality which allows you to use -.CO vi -to review source code in a structured manner. -.pp -.CO Nvi -also provides two other basic -.CO ex -commands for tag support: -.CO tagpop -and -.CO tagtop . +@CO{vi} + to review source code in a structured manner. + +@CO{Nvi} + also provides two other basic +@CO{ex} + commands for tag support: +@CO{tagpop} + and +@CO{tagtop} . The -.CO tagpop -command is identical to the -.CO -command, +@CO{tagpop} + command is identical to the +@CO{} + command, with the additional functionality that you may specify that modifications to the current file are to be discarded. This cannot be done using the -.CO -command. +@CO{} + command. The -.CO tagtop -command discards all of the contexts that have been pushed onto the tag +@CO{tagtop} + command discards all of the contexts that have been pushed onto the tag stack, returning to the context from which the first -.CO -or -.CO tag -command was entered. -.pp +@CO{} + or +@CO{tag} + command was entered. + The historic -.XR ctags 1 +@XR{ctags,1} tags file format supports only a single location per tag, normally the function declaration or structure or string definition. More sophisticated source code tools often provide multiple locations @@ -785,818 +776,821 @@ per tag, e.g., a list of the places from which a function is called or a string definition is used. An example of this functionality is the System V source code tool, -.CO cscope . -.sp -.CO Cscope -creates a database of information on source code files, +@CO{cscope} . +@sp 1 +@CO{Cscope} + creates a database of information on source code files, and supports a query language for that information as described in the -.XR cscope 1 +@XR{cscope,1} manual page. -.CO Nvi -contains an interface to the -.CO cscope -query language which permits you to query -.CO cscope -and then sequentially step through the locations in the sources files which -.CO cscope -returns. +@CO{Nvi} + contains an interface to the +@CO{cscope} + query language which permits you to query +@CO{cscope} + and then sequentially step through the locations in the sources files which +@CO{cscope} + returns. There are two -.CO nvi -commands which support this ability to step through multiple locations. +@CO{nvi} + commands which support this ability to step through multiple locations. They are the -.CO ex -commands -.CO tagnext -and -.CO tagprev . +@CO{ex} + commands +@CO{tagnext} + and +@CO{tagprev} . The -.CO tagnext -command moves to the next location for the current tag. +@CO{tagnext} + command moves to the next location for the current tag. The -.CO tagprev -command moves to the previous location for the current tag. +@CO{tagprev} + command moves to the previous location for the current tag. (See the -.CO tagnext -and -.CO tagprev -command discussion in the -.CO ex -commands section of this manual for more information.) +@CO{tagnext} + and +@CO{tagprev} + command discussion in the +@CO{ex} + commands section of this manual for more information.) At any time during this sequential walk, you may use the -.CO , -.CO tag -or -.CO cscope -commands to move to a new tag context, and then use the -.CO -or -.CO tagpop -commands to return and continue stepping through the locations for this +@CO{} , +@CO{tag} + or +@CO{cscope} + commands to move to a new tag context, and then use the +@CO{} + or +@CO{tagpop} + commands to return and continue stepping through the locations for this tag. This is similar to the previous model of a simple tag stack, except that each entry in the tag stack may have more than one file context that is of interest. -.pp + Although there is no widely distributed version of -.XR ctags 1 +@XR{ctags,1} that creates tags files with multiple locations per tag, -.CO nvi -has been written to understand the obvious extension to the historic +@CO{nvi} + has been written to understand the obvious extension to the historic tags file format, i.e., more than a single line in the tags file with the same initial tag name. If you wish to extend your -.CO ctags +@CO{ctags} implementation or other tool with which you build tags files, this extension should be simple and will require no changes to -.CO nvi . -.pp +@CO{nvi} . + The -.CO nvi -and -.CO cscope -interface is based on the new -.CO ex -command -.CO cscope , +@CO{nvi} + and +@CO{cscope} + interface is based on the new +@CO{ex} + command +@CO{cscope} , which has five subcommands: -.CO add , -.CO find , -.CO help , -.CO kill -and -.CO reset . +@CO{add} , +@CO{find} , +@CO{help} , +@CO{kill} + and +@CO{reset} . The subcommand -.CO find -itself has eight subcommands: -.CO \&c , -.CO \&d , -.CO \&e , -.CO \&f , -.CO \&g , -.CO \&i , -.CO \&s -and -.CO \&t . -.pp -.IP "cs[cope] a[dd] file" +@CO{find} + itself has eight subcommands: +@CO{c} , +@CO{d} , +@CO{e} , +@CO{f} , +@CO{g} , +@CO{i} , +@CO{s} + and +@CO{t} . + +@itemize @bullet +@IP{cs[cope] a[dd] file} + The -.CO add -command attaches to the specified -.CO cscope -database. +@CO{add} + command attaches to the specified +@CO{cscope} + database. The file name is expanded using the standard filename expansions. If -.CO file -is a directory, the file -.QQ cscope.out +@CO{file} + is a directory, the file +@QQ{cscope.out} in that directory is used as the database. -.pp + After -.CO nvi -attaches to a new database, +@CO{nvi} + attaches to a new database, all subsequent -.CO cscope -queries will be asked of that database. +@CO{cscope} + queries will be asked of that database. The result of any single query is the collection of response to the query from all of the attached databases. -.sp +@sp 1 If the -.QQ CSCOPE_DIRS +@QQ{CSCOPE_DIRS} environmental variable is set when -.CO nvi -is run, +@CO{nvi} + is run, it is expected to be a or -separated list of -.CO cscope -databases or directories containing -.CO cscope -databases, to which the user wishes to attach. -.IP ":cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern" +@CO{cscope} + databases or directories containing +@CO{cscope} + databases, to which the user wishes to attach. +@IP{:cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern} + The -.CO find -command is the -.CO cscope -query command for -.CO nvi . +@CO{find} + command is the +@CO{cscope} + query command for +@CO{nvi} . For this command, -.CO nvi -queries all attached -.CO cscope -databases for the pattern. +@CO{nvi} + queries all attached +@CO{cscope} + databases for the pattern. If the pattern is a double-quote character followed by a valid buffer name (e.g., -.LI """" ), +@LI{}"" ), then the contents of the named buffer are used as the pattern. Otherwise, the pattern is a Regular Expression. -.sp +@sp 1 The -.CO find -command pushes the current location onto the tags stack, +@CO{find} + command pushes the current location onto the tags stack, and switches to the first location resulting from the query, if the query returned at least one result. -.sp +@sp 1 File names returned by the -.CO cscope -query, if not absolute paths, are searched for relative to the directory +@CO{cscope} + query, if not absolute paths, are searched for relative to the directory where the -.CO cscope -database is located. +@CO{cscope} + database is located. In addition, if the file -.QQ cscope.tpath +@QQ{cscope.tpath} appears in the same directory as the -.CO cscope -database, +@CO{cscope} + database, it is expected to contain a colon-separated list of directory names where files referenced by its associated -.CO cscope -database may be found. -.sp +@CO{cscope} + database may be found. +@sp 1 The -.CO find -subcommand is one of the following: -.SS -.SP \&c +@CO{find} + subcommand is one of the following: +@table @asis +@item c Find callers of the name. -.SP \&d +@item d Find all function calls made from name. -.SP \&e +@item e Find pattern. -.SP \&f +@item f Find files with name as substring. -.SP \&g +@item g Find definition of name. -.SP \&i +@item i Find files #including name. -.SP \&s +@item s Find all uses of name. -.SP \&t +@item t Find assignments to name. -.SE -.IP ":cs[cope] h[elp] [command]" +@end table +@IP{:cs[cope] h[elp] [command]} + List the -.CO cscope -commands, +@CO{cscope} + commands, or optionally list usage help for any single -.CO cscope -command. -.IP ":display c[onnections]" +@CO{cscope} + command. +@IP{:display c[onnections]} + Display the list of -.CO cscope -databases to which -.CO nvi -is currently connected. -.IP ":cs[cope] k[ill] #" +@CO{cscope} + databases to which +@CO{nvi} + is currently connected. +@IP{:cs[cope] k[ill] #} + Disconnect from a specific -.CO cscope -database. +@CO{cscope} + database. The connection number is the one displayed by the -.CO ex -.CO "display connections" +@CO{ex} + @CO{display connections} command. -.IP ":cs[cope] r[eset]" +@IP{:cs[cope] r[eset]} + Disconnect from all attached -.CO cscope -databases. -.pp +@CO{cscope} + databases. +@end itemize + Cscope is not freely redistributable software, but is fairly inexpensive and easily available. To purchase a copy of -.CO cscope , +@CO{cscope} , see http://www.att.com/ssg/products/toolchest.html. -.SH 1 "Regular Expressions and Replacement Strings" -.pp +@chapter Regular Expressions and Replacement Strings + Regular expressions are used in line addresses, as the first part of the -.CO ex -.CO substitute , -.CO global , +@CO{ex} + @CO{substitute} , +@CO{global} , and -.CO v -commands, and in search patterns. -.pp +@CO{v} + commands, and in search patterns. + The regular expressions supported by -.EV ex vi +@EV{ex,vi} are, by default, the Basic Regular Expressions (BRE's) described in the IEEE POSIX Standard 1003.2. The -.OP extended +@OP{extended} option causes all regular expressions to be interpreted as the Extended Regular Expressions (ERE's) described by the same standard. (See -.XR re_format 7 +@XR{re_format,7} for more information.) Generally speaking, BRE's are the Regular Expressions found in -.XR ed 1 +@XR{ed,1} and -.XR grep 1 , +@XR{grep,1}, and ERE's are the Regular Expressions found in -.XR egrep 1 . -.pp +@XR{egrep,1}. + The following is not intended to provide a description of Regular Expressions. The information here only describes strings and characters which have special meanings in the -.EV ex vi +@EV{ex,vi} version of RE's, or options which change the meanings of characters that normally have special meanings in RE's. -.np +@enumerate +@item An empty RE (e.g. -.QT // +@QT{//} or -.QT ?? +@QT{??} is equivalent to the last RE used. -.np +@item The construct -.QT \e< +@QT{\e<} matches the beginning of a word. -.np +@item The construct -.QT \e> +@QT{\e>} matches the end of a word. -.np +@item The character -.QT ~ +@QT{~} matches the replacement part of the last -.CO substitute -command. -.pp +@CO{substitute} + command. +@end enumerate + When the -.OP magic +@OP{magic} option is -.i not +@emph{not} set, the only characters with special meanings are a -.QT ^ +@QT{^} character at the beginning of an RE, a -.QT $ +@QT{$} character at the end of an RE, and the escaping character -.QT \e . +@QT{\e}. The characters -.QT \&. , -.QT * , -.QT [ +@QT{.}, +@QT{*}, +@QT{[} and -.QT ~ +@QT{~} are treated as ordinary characters unless preceded by a -.QT \e ; +@QT{\e}; when preceded by a -.QT \e +@QT{\e} they regain their special meaning. -.pp + Replacement strings are the second part of a -.CO substitute -command. -.pp +@CO{substitute} + command. + The character -.QT & +@QT{&} (or -.QT \e& +@QT{\e&} if the -.OP magic +@OP{magic} option is -.i not +@emph{not} set) in the replacement string stands for the text matched by the RE that is being replaced. The character -.QT ~ +@QT{~} (or -.QT \e~ +@QT{\e~} if the -.OP magic +@OP{magic} option is -.i not +@emph{not} set) stands for the replacement part of the previous -.CO substitute -command. +@CO{substitute} + command. It is only valid after a -.CO substitute -command has been performed. -.pp +@CO{substitute} + command has been performed. + The string -.QT \e# , +@QT{\e#}, where -.QT # +@QT{#} is an integer value from 1 to 9, stands for the text matched by the portion of the RE enclosed in the -.QT # 'th +@QT{#}'th set of escaped parentheses, e.g. -.QT \e( +@QT{\e(} and -.QT \e) . +@QT{\e)}. For example, -.QT "s/abc\e(.*\e)def/\e1/" +@QT{s/abc\e(.*\e)def/\e1/} deletes the strings -.QT abc +@QT{abc} and -.QT def +@QT{def} from the matched pattern. -.pp + The strings -.QT \el , -.QT \eu , -.QT \eL +@QT{\el}, +@QT{\eu}, +@QT{\eL} and -.QT \eU +@QT{\eU} can be used to modify the case of elements in the replacement string. The string -.QT \el +@QT{\el} causes the next character to be converted to lowercase; the string -.QT \eu +@QT{\eu} behaves similarly, but converts to uppercase (e.g. -.LI s/abc/\eU&/ -replaces the string -.LI abc -with -.LI ABC ). +@LI{s/abc/\eU&/}replaces the string +@LI{abc}with +@LI{ABC}). The string -.QT \eL +@QT{\eL} causes characters up to the end of the string or the next occurrence of the strings -.QT \ee +@QT{\ee} or -.QT \eE +@QT{\eE} to be converted to lowercase; the string -.QT \eU +@QT{\eU} behaves similarly, but converts to uppercase. -.pp + If the entire replacement pattern is -.QT % , +@QT{%}, then the last replacement pattern is used again. -.pp + In -.CO vi , +@CO{vi} , inserting a -.LI -into the replacement string will cause +@LI{}into the replacement string will cause the matched line to be split into two lines at that point. (The -.LI -will be discarded.) -.SH 1 "Scripting Languages" -.pp +@LI{}will be discarded.) +@chapter Scripting Languages + The -.CO nvi -editor currently supports two scripting languages, Tcl/Tk and Perl. +@CO{nvi} + editor currently supports two scripting languages, Tcl/Tk and Perl. (Note that Perl4 isn't sufficient, and that the Perl5 used must be version 5.002 or later. See the -.QB "Building Nvi" +@QB{Building Nvi} section for more information. -.pp + The scripting language interface is still being worked on, therefore the following information is probably incomplete, probably wrong in cases, and likely to change. See the -.LI perl_api -and -.LI tcl_api -source directories for more information. +@LI{perl_api}and +@LI{tcl_api}source directories for more information. As a quick reference, the following function calls are provided for both the Perl and Tcl interfaces. The Perl interface uses a slightly different naming convention, e.g. ``viFindScreen'' is named ``VI::FindScreen''. -.IP "viFindScreen file" +@itemize @bullet +@IP{viFindScreen file} + Return the -.LI "screenId" associated with -.LI file . -.IP "viAppendLine screenId lineNumber text" +@LI{screenId}associated with +@LI{file}. +@IP{viAppendLine screenId lineNumber text} + Append -.LI text -as a new line after line number -.LI lineNumber , +@LI{text}as a new line after line number +@LI{lineNumber}, in the screen -.LI screenId . -.IP "viDelLine screenId lineNum" +@LI{screenId}. +@IP{viDelLine screenId lineNum} + Delete the line -.LI lineNumber -from the screen -.LI screenId . -.IP "viGetLine screenId lineNumber" +@LI{lineNumber}from the screen +@LI{screenId}. +@IP{viGetLine screenId lineNumber} + Return the line -.LI lineNumber -from the screen -.LI screenId . -.IP "viInsertLine screenId lineNumber text" +@LI{lineNumber}from the screen +@LI{screenId}. +@IP{viInsertLine screenId lineNumber text} + Insert -.LI text -as a new line before line number -.LI lineNumber -in the screen -.LI screenId . -.IP "viLastLine screenId" +@LI{text}as a new line before line number +@LI{lineNumber}in the screen +@LI{screenId}. +@IP{viLastLine screenId} + Return the line number of the last line in the screen -.LI screenId . -.IP "viSetLine screenId lineNumber text" +@LI{screenId}. +@IP{viSetLine screenId lineNumber text} + Change the line -.LI lineNumber -in the screen -.LI screenId -to match the specified -.LI text . -.IP "viGetMark screenId mark" +@LI{lineNumber}in the screen +@LI{screenId}to match the specified +@LI{text}. +@IP{viGetMark screenId mark} + Return the current line and column for the specified -.LI mark -from the screen -.LI screenId . -.IP "viSetMark screenId mark line column" +@LI{mark}from the screen +@LI{screenId}. +@IP{viSetMark screenId mark line column} + Set the specified -.LI mark -to be at line -.LI line , +@LI{mark}to be at line +@LI{line}, column -.LI column , +@LI{column}, in the screen -.LI screenId . -.IP "viGetCursor screenId" +@LI{screenId}. +@IP{viGetCursor screenId} + Return the current line and column for the cursor in the screen -.LI screenId . -.IP "viSetCursor screenId line column" +@LI{screenId}. +@IP{viSetCursor screenId line column} + Set the cursor in the screen -.LI screenId -to the specified -.LI line -and -.LI column . -.IP "viMsg screenId text" +@LI{screenId}to the specified +@LI{line}and +@LI{column}. +@IP{viMsg screenId text} + Display the specified -.LI text -as a vi message in the screen -.LI screenId . -.IP "viNewScreen screenId [file]" +@LI{text}as a vi message in the screen +@LI{screenId}. +@IP{viNewScreen screenId [file]} + Create a new screen. -.IP "viEndScreen screenId" +@IP{viEndScreen screenId} + Exit the screen -.LI screenId . -.IP "viSwitchScreen screenId screenId" +@LI{screenId}. +@IP{viSwitchScreen screenId screenId} + Switch from the screen -.LI screenId -to the screen -.LI screenId . -.IP "viMapKey screenId key tclproc" +@LI{screenId}to the screen +@LI{screenId}. +@IP{viMapKey screenId key tclproc} + Map the specified -.LI key -in the screen -.LI screenId -to the Tcl procedure -.LI tclproc . -.IP "viUnmMapKey screenId key" +@LI{key}in the screen +@LI{screenId}to the Tcl procedure +@LI{tclproc}. +@IP{viUnmMapKey screenId key} + Unmap the specified -.LI key -in the screen -.LI screenId -.IP "viGetOpt screenId option" +@LI{key}in the screen +@LI{screenId}@IP{viGetOpt screenId option} + Return the value of the specified -.LI option -from the screen -.LI screenId . -.IP "viSetOpt screenId command" +@LI{option}from the screen +@LI{screenId}. +@IP{viSetOpt screenId command} + Set one or more options in the screen -.LI screenId . -.SH 1 "General Editor Description" -.pp +@LI{screenId}. +@end itemize +@chapter General Editor Description + When -.CO ex -or -.CO vi -are executed, +@CO{ex} + or +@CO{vi} + are executed, the text of a file is read (or a temporary file is created), and then all editing changes happen within the context of the copy of the file. -.i "No changes affect the actual file until the file is written out" , +@emph{No changes affect the actual file until the file is written out}, either using a write command or another command which is affected by the -.OP autowrite +@OP{autowrite} option. -.pp + All files are locked (using the -.XR flock 2 +@XR{flock,2} or -.XR fcntl 2 +@XR{fcntl,2} interfaces) during the edit session, to avoid inadvertently making modifications to multiple copies of the file. If a lock cannot be obtained for a file because it is locked by another process, the edit session is read-only (as if the -.OP readonly +@OP{readonly} option or the -.b \-R +@strong{-R} flag had been specified). If a lock cannot be obtained for other reasons, the edit session will continue, but the file status information (see the -.CO -command) will reflect this fact. -.pp +@CO{} + command) will reflect this fact. + Both -.CO ex -and -.CO vi -are modeful editors, i.e. they have two modes, -.QQ command +@CO{ex} + and +@CO{vi} + are modeful editors, i.e.@: they have two modes, +@QQ{command} mode and -.QQ "text input" +@QQ{text input} mode. The former is intended to permit you to enter commands which modifies already existing text. The latter is intended to permit you to enter new text. When -.CO ex -first starts running, it is in command mode, and usually displays a prompt +@CO{ex} + first starts running, it is in command mode, and usually displays a prompt (see the -.OP prompt +@OP{prompt} option for more information). The prompt is a single colon -.PQ : +@PQ{:} character. There are three commands that switch -.CO ex -into text input mode: -.CO append , -.CO change -and -.CO insert . +@CO{ex} + into text input mode: +@CO{append} , +@CO{change} + and +@CO{insert} . Once in input mode, entering a line containing only a single period -.PQ \&. +@PQ{.} ends text input mode and returns to command mode, where the prompt is redisplayed. -.pp + When -.CO vi -first starts running, it is in command mode as well. +@CO{vi} + first starts running, it is in command mode as well. There are eleven commands that switch -.CO vi -into text input mode: -.CO A , -.CO a , -.CO C , -.CO c , -.CO I , -.CO i , -.CO O , -.CO o , -.CO R , -.CO S -and -.CO s . +@CO{vi} + into text input mode: +@CO{A} , +@CO{a} , +@CO{C} , +@CO{c} , +@CO{I} , +@CO{i} , +@CO{O} , +@CO{o} , +@CO{R} , +@CO{S} + and +@CO{s} . Once in input mode, entering an -.LI -character ends text input mode and returns to command mode. -.pp -.EV Ex vi +@LI{}character ends text input mode and returns to command mode. + +@EV{Ex,vi} present three different interfaces to editing a file. -.CO Ex -presents a line oriented interface. -.CO Vi -presents a full screen display oriented interface, +@CO{Ex} + presents a line oriented interface. +@CO{Vi} + presents a full screen display oriented interface, also known as -.QQ "visual mode" . +@QQ{visual mode}. In addition, there is a third mode, -.QQ "open mode" , +@QQ{open mode}, which is line oriented, but supports cursor movement and editing within the displayed line, similarly to visual mode. Open mode is not yet implemented in -.CO nvi . -.pp +@CO{nvi} . + The following words have special meanings in both the -.CO ex -and -.CO vi -command descriptions: -.KY -.IP +@CO{ex} + and +@CO{vi} + command descriptions: +@itemize @bullet +@cindex +@IP{} + The interrupt character is used to interrupt the current operation. Normally -.LI , +@LI{}, whatever character is set for the current terminal is used. -.KY "" -.IP "" +@cindex "" +@IP{} + The literal next character is used to escape the subsequent character from any special meaning. This character is always -.LI . +@LI{}. If the terminal is not set up to do XON/XOFF flow control, then -.LI -is used to mean literal next as well. -.KY "current pathname" -.IP "current pathname" +@LI{}is used to mean literal next as well. +@cindex "current pathname" +@IP{current pathname} + The pathname of the file currently being edited by vi. When the percent character -.PQ % +@PQ{%} appears in a file name entered as part of an -.CO ex -command argument, it is replaced by the current pathname. +@CO{ex} + command argument, it is replaced by the current pathname. (The -.QT % +@QT{%} character can be escaped by preceding it with a backslash.) -.KY "alternate pathname" -.IP "alternate pathname" +@cindex "alternate pathname" +@IP{alternate pathname} + The name of the last file name mentioned in an -.CO ex -command, or, +@CO{ex} + command, or, the previous current pathname if the last file mentioned becomes the current file. When the hash mark character -.PQ # +@PQ{#} appears in a file name entered as part of an -.CO ex -command argument, it is replaced by the alternate pathname. +@CO{ex} + command argument, it is replaced by the alternate pathname. (The -.QT # +@QT{#} character can be escaped by preceding it with a backslash.) -.KY buffer -.IP buffer +@cindex buffer +@IP{buffer} + One of a number of named areas for saving copies of text. Commands that change or delete text can save the changed or deleted text into a specific buffer, for later use, if the command allows -it (i.e. the -.CO ex -.CO change -command cannot save the changed text in a named buffer). +it (i.e.@: the +@CO{ex} + @CO{change} + command cannot save the changed text in a named buffer). Buffers are named with a single character, preceded by a double quote, e.g. -.LI """" +@LI{}"" in -.CO vi -and +@CO{vi} + and without the double quote, e.g. -.LI , +@LI{}, in -.CO ex . +@CO{ex} . (The double quote isn't necessary for -.CO ex -because buffers names are denoted by their position in the command line.) +@CO{ex} + because buffers names are denoted by their position in the command line.) Historic implementations of -.EV ex vi +@EV{ex,vi} limited -.LI -to the alphanumeric characters; -.EV nex nvi +@LI{}to the alphanumeric characters; +@EV{nex,nvi} permits the use of any character without another meaning in the position where a buffer name is expected. -.sp +@sp 1 Buffers named by uppercase characters are the same as buffers named by lowercase characters, e.g. the buffer named by the English character -.QT A +@QT{A} is the same as the buffer named by the character -.QT a , +@QT{a}, with the exception that, if the buffer contents are being changed (as with a text deletion or -.CO vi -.CO change -command), the text is -.i appended +@CO{vi} + @CO{change} + command), the text is +@emph{appended} to the buffer, instead of replacing the current contents. -.sp +@sp 1 The buffers named by the numeric characters (in English, -.QT 1 +@QT{1} through -.QT 9 ), +@QT{9}), are special. If a region of text including characters from more than one line, or a single line of text specified by using a line-oriented motion, is changed or deleted in the file using the -.CO vi -.CO change -or -.CO delete -commands, a copy of the text is placed into the numeric buffer -.QT 1 , +@CO{vi} + @CO{change} + or +@CO{delete} + commands, a copy of the text is placed into the numeric buffer +@QT{1}, regardless of the user specifying another buffer in which to save it. In addition, there are a few commands which, when used as a -.LI motion -with the -.CO vi -.CO change -and -.CO delete -commands, -.i always +@LI{motion}with the +@CO{vi} + @CO{change} + and +@CO{delete} + commands, +@emph{always} copy the specified region of text into the numeric buffers regardless of the region including characters from more than one line. These commands are: -.sp -.ne 3v -.ft C -.TS -r r r r. - % ( ) -` / ? N -n { } -.TE -.ft R -.sp +@sp 1 +@multitable {@CO{'}} {@CO{AA}} {@CO{AA}} {@CO{AA}} +@item @CO{} @tab @CO{%} @tab @CO{(} @tab @CO{)} +@item @CO{`} @tab @CO{/} @tab @CO{?} @tab @CO{N} +@item @CO{n} @tab @strong{@{} @tab @strong{@}} +@end multitable +@sp 1 Before this copy is done, the previous contents of buffer -.QT 1 +@QT{1} are moved into buffer -.QT 2 , -.QT 2 +@QT{2}, +@QT{2} into buffer -.QT 3 , +@QT{3}, and so on. The contents of buffer -.QT 9 +@QT{9} are discarded. In -.CO vi , +@CO{vi} , text may be explicitly stored into the numeric buffers. In this case, the buffer rotation described above occurs before the replacement of the buffer's contents. The numeric buffers are only available in -.LI visual -and -.LI open -modes, +@LI{visual}and +@LI{open}modes, and are not accessible by -.CO ex -in any way, although changed and deleted text is still stored there +@CO{ex} + in any way, although changed and deleted text is still stored there while in -.CO ex -mode. -.sp +@CO{ex} + mode. +@sp 1 When a -.CO vi -command synopsis shows both a -.LI [buffer] -and a -.LI [count] , +@CO{vi} + command synopsis shows both a +@LI{[buffer]}and a +@LI{[count]}, they may be presented in any order. -.sp +@sp 1 Finally, all buffers are either -.QQ line +@QQ{line} or -.QQ character +@QQ{character} oriented. All -.CO ex -commands which store text into buffers are line oriented. +@CO{ex} + commands which store text into buffers are line oriented. Some -.CO vi -commands which store text into buffers are line oriented, +@CO{vi} + commands which store text into buffers are line oriented, and some are character oriented; the description for each applicable -.CO vi -command notes whether text copied into buffers using the command +@CO{vi} + command notes whether text copied into buffers using the command is line or character oriented. In addition, the -.CO vi -command -.CO "display buffers" +@CO{vi} + command +@CO{display buffers} displays the current orientation for each buffer. Generally, the only importance attached to this orientation is that if the buffer is subsequently inserted into the text, line oriented buffers create new lines for each of the lines they contain, and character oriented buffers create new lines for any lines -.i other +@emph{other} than the first and last lines they contain. The first and last lines are inserted into the text at the current cursor position, becoming part of the current line. If there is more than one line in the buffer, however, the current line itself will be split. -.KY "unnamed buffer" -.IP "unnamed buffer" +@cindex "unnamed buffer" +@IP{unnamed buffer} + The unnamed buffer is a text storage area which is used by commands that use or operate on a buffer when no buffer is specified by the user. If the command stores text into a buffer, @@ -1607,193 +1601,196 @@ If text is appended to a named buffer, the named buffer contains both the old and new text, while the unnamed buffer contains only the new text. There is no way to explicitly reference the unnamed buffer. -.sp +@sp 1 Historically, the contents of the unnamed buffer were discarded by many different commands, even ones that didn't store text into it. -.EV Nex nvi +@EV{Nex,nvi} never discards the contents of the unnamed buffer until new text replaces them. -.KY whitespace -.IP whitespace +@cindex whitespace +@IP{whitespace} + The characters and . -.KY "" -.IP "" +@cindex "" +@IP{} + The character represented by an ASCII -.LI . +@LI{}. This character is almost always treated identically to a -.LI -character, but differs in that it can be escaped into the file text or +@LI{}character, but differs in that it can be escaped into the file text or into a command. -.KY -.IP +@cindex +@IP{} + The character represented by an ASCII -.LI . +@LI{}. This character is almost always treated identically to a -.LI -character, but differs in that it cannot be escaped into the file text or +@LI{}character, but differs in that it cannot be escaped into the file text or into a command. -.oh 'Vi/Ex Reference (Vi Commands)''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference (Vi Commands)' -.so vi.cmd.roff -.oh 'Vi/Ex Reference''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference' -.SH 1 "Ex Addressing" -.pp +@end itemize +@comment .oh 'Vi/Ex Reference (Vi Commands)''USD:13-%' +@comment .eh 'USD:13-%''Vi/Ex Reference (Vi Commands)' +@include vi.cmd.texi +@comment .oh 'Vi/Ex Reference''USD:13-%' +@comment .eh 'USD:13-%''Vi/Ex Reference' +@chapter Ex Addressing + Addressing in -.CO ex -(and when -.CO ex -commands are executed from -.CO vi ) +@CO{ex} + (and when +@CO{ex} + commands are executed from +@CO{vi} ) relates to the current line. In general, the current line is the last line affected by a command. The exact effect on the current line is discussed under the description of each command. When the file contains no lines, the current line is zero. -.pp + Addresses are constructed by one or more of the following methods: -.np +@enumerate +@item The address -.QT \&. +@QT{.} refers to the current line. -.np +@item The address -.QT $ +@QT{$} refers to the last line of the file. -.np +@item The address -.QT N , +@QT{N}, where -.LI N -is a positive number, refers to the N-th line of the file. -.np +@LI{N}is a positive number, refers to the N-th line of the file. +@item The address -.QT ' +@QT{'} or -.QT ` +@QT{`} refers to the line marked with the name -.LI . +@LI{}. (See the -.CO k -or -.CO m -commands for more information on how to mark lines.) -.np +@CO{k} + or +@CO{m} + commands for more information on how to mark lines.) +@item A regular expression (RE) enclosed by slashes -.PQ / +@PQ{/} is an address, and it refers to the first line found by searching forward from the line -.i after +@emph{after} the current line toward the end of the file, and stopping at the first line containing a string matching the RE. (The trailing slash can be omitted at the end of the command line.) -.sp -If no RE is specified, i.e. the pattern is -.QT // , +@sp 1 +If no RE is specified, i.e.@: the pattern is +@QT{//}, the last RE used in any command is used in the search. -.sp +@sp 1 If the -.OP extended +@OP{extended} option is set, the RE is handled as an extended RE, not a basic RE. If the -.OP wrapscan +@OP{wrapscan} option is set, the search wraps around to the beginning of the file and continues up to and including the current line, so that the entire file is searched. -.sp +@sp 1 The form -.QT \e/ +@QT{\e/} is accepted for historic reasons, and is identical to -.QT // . -.np +@QT{//}. +@item An RE enclosed in question marks -.PQ ? +@PQ{?} addresses the first line found by searching backward from the line -.i preceding +@emph{preceding} the current line, toward the beginning of the file and stopping at the first line containing a string matching the RE. (The trailing question mark can be omitted at the end of a command line.) -.sp -If no RE is specified, i.e. the pattern is -.QT ?? , +@sp 1 +If no RE is specified, i.e.@: the pattern is +@QT{??}, the last RE used in any command is used in the search. -.sp +@sp 1 If the -.OP extended +@OP{extended} option is set, the RE is handled as an extended RE, not a basic RE. If the -.OP wrapscan +@OP{wrapscan} option is set, the search wraps around from the beginning of the file to the end of the file and continues up to and including the current line, so that the entire file is searched. -.sp +@sp 1 The form -.QT \e? +@QT{\e?} is accepted for historic reasons, and is identical to -.QT ?? . -.np +@QT{??}. +@item An address followed by a plus sign -.PQ + +@PQ{+} or a minus sign -.PQ - +@PQ{-} followed by a number is an offset address and refers to the address plus (or minus) the indicated number of lines. If the address is omitted, the addition or subtraction is done with respect to the current line. -.np +@item An address of -.QT + +@QT{+} or -.QT \- +@QT{-} followed by a number is an offset from the current line. For example, -.QT \-5 +@QT{-5} is the same as -.QT \&.\-5 . -.np +@QT{.-5}. +@item An address ending with -.QT + +@QT{+} or -.QT - +@QT{-} has 1 added to or subtracted from the address, respectively. As a consequence of this rule and of the previous rule, the address -.QT \- +@QT{-} refers to the line preceding the current line. Moreover, trailing -.QT + +@QT{+} and -.QT \- +@QT{-} characters have a cumulative effect. For example, -.QT ++\-++ +@QT{++-++} refers to the current line plus 3. -.np +@item A percent sign -.PQ % +@PQ{%} is equivalent to the address range -.QT 1,$ . -.pp -.CO Ex -commands require zero, one, or two addresses. +@QT{1,$}. +@end enumerate + +@CO{Ex} + commands require zero, one, or two addresses. It is an error to specify an address to a command which requires zero addresses. -.pp + If the user provides more than the expected number of addresses to any -.CO ex -command, the first addresses specified are discarded. +@CO{ex} + command, the first addresses specified are discarded. For example, -.QT 1,2,3,5 print +@QT{1,2,3,5}print prints lines 3 through 5, because the -.CO print -command only takes two addresses. -.pp +@CO{print} + command only takes two addresses. + The addresses in a range are separated from each other by a comma -.PQ , +@PQ{,} or a semicolon -.PQ ; . +@PQ{;}. In the latter case, the current line -.PQ \&. +@PQ{.} is set to the first address, and only then is the second address calculated. This feature can be used to determine the starting line for forward and backward searches (see rules (5) and (6) above). @@ -1803,28 +1800,16 @@ The first address must be less than or equal to the second address. The first address must be greater than or equal to the first line of the file, and the last address must be less than or equal to the last line of the file. -.oh 'Vi/Ex Reference (Ex Commands)''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference (Ex Commands)' -.so ex.cmd.roff -.oh 'Vi/Ex Reference (Options)''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference (Options)' -.so set.opt.roff -.oh 'Vi/Ex Reference''USD:13-%' -.eh 'USD:13-%''Vi/Ex Reference' -.bp -.SH 1 Index -.lp -.ie t .2c +0.5i 3 -.el .2c +0.5i 2 -.ta \n($luR -.nf -.so index.so -.fi -.\" Force the TOC to an odd page, in case it's a duplex printer. -.if o .bp -.bp 3 -.1c -.ce 1 -\fB\s+2Table of Contents\s0\fP -.sp -.xp +@comment .oh 'Vi/Ex Reference (Ex Commands)''USD:13-%' +@comment .eh 'USD:13-%''Vi/Ex Reference (Ex Commands)' +@include ex.cmd.texi +@comment .oh 'Vi/Ex Reference (Options)''USD:13-%' +@comment .eh 'USD:13-%''Vi/Ex Reference (Options)' +@include set.opt.texi +@comment .oh 'Vi/Ex Reference''USD:13-%' +@comment .eh 'USD:13-%''Vi/Ex Reference' +@page +@chapter Index +@printindex cp +@comment Force the TOC to an odd page, in case it's a duplex printer. +@bye -- 2.11.4.GIT