From 6f5fcc76ef4c25e309a111bf2638883e5aeef070 Mon Sep 17 00:00:00 2001 From: cgd Date: Mon, 28 Mar 1994 02:52:06 +0000 Subject: [PATCH] nvi/nex 1.11beta from bostic. --- usr.bin/vi/docs/README | 152 ++-- usr.bin/vi/docs/bugs.current | 11 +- usr.bin/vi/docs/changelog | 119 ++- usr.bin/vi/docs/features | 47 ++ usr.bin/vi/docs/internals/autowrite | 88 ++ usr.bin/vi/docs/internals/gdb.script | 68 ++ usr.bin/vi/docs/internals/input | 314 ++++++++ usr.bin/vi/docs/internals/quoting | 219 +++++ usr.bin/vi/docs/internals/structures | 61 ++ usr.bin/vi/docs/set.opt.roff | 1065 +++++++++++++++++++++++++ usr.bin/vi/docs/spell.ok | 96 +++ usr.bin/vi/docs/vi.0.ps | 697 ++++++++++------ usr.bin/vi/docs/vi.0.txt | 511 +++++++----- usr.bin/vi/docs/vi.ref | 544 +++++++++++++ usr.bin/vi/docs/vi.ref.ps | 1108 ++++++++++++++++++++++++++ usr.bin/vi/docs/vi.ref.txt | 634 +++++++++++++++ usr.bin/vi/intr.c | 179 +++++ usr.bin/vi/put.c | 249 ++++++ usr.bin/vi/vi/v_zexit.c | 89 +++ 19 files changed, 5730 insertions(+), 521 deletions(-) create mode 100644 usr.bin/vi/docs/features create mode 100644 usr.bin/vi/docs/internals/autowrite create mode 100644 usr.bin/vi/docs/internals/gdb.script create mode 100644 usr.bin/vi/docs/internals/input create mode 100644 usr.bin/vi/docs/internals/quoting create mode 100644 usr.bin/vi/docs/internals/structures create mode 100644 usr.bin/vi/docs/set.opt.roff create mode 100644 usr.bin/vi/docs/vi.ref create mode 100644 usr.bin/vi/docs/vi.ref.ps create mode 100644 usr.bin/vi/docs/vi.ref.txt create mode 100644 usr.bin/vi/intr.c create mode 100644 usr.bin/vi/put.c create mode 100644 usr.bin/vi/vi/v_zexit.c diff --git a/usr.bin/vi/docs/README b/usr.bin/vi/docs/README index a61d1053c402..e46f4de58bd1 100644 --- a/usr.bin/vi/docs/README +++ b/usr.bin/vi/docs/README @@ -1,12 +1,13 @@ -# @(#)README 8.42 (Berkeley) 1/23/94 +# @(#)README 8.54 (Berkeley) 3/24/94 -This is the README for version 1.03 of nvi, a freely redistributable -replacement for the vi and ex text editors. It can be retrieved via -anonymous ftp from ftp.uu.net, or from ftp.cs.berkeley.edu. In the -latter, it is in the directory ucb/4bsd, and is named nvi.tar.Z. +This is the README for version 1.11 of nex/nvi, a freely redistributable +replacement for the Berkeley ex and vi text editors. The compressed tar +archive can be retrieved by anonymous ftp from ftp.cs.berkeley.edu, from +the file ucb/4bsd/nvi.tar.Z. There is a gzip'd tar archive, nvi.tar.z, +in the same directory. -If you have any questions or problems with nvi, please send them to -me by electronic mail at one of the following addresses: +If you have any questions about nvi, or problems making it work, please +contact me by electronic mail at one of the following addresses: uunet!bostic bostic@cs.berkeley.edu @@ -16,12 +17,12 @@ Keith Bostic =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= o Redistribution: -Nvi is copyrighted by the The Regents of the University of California, -but may be freely redistributed (or used to line your birdcage) under -the following conditions: +This software is copyrighted by the The Regents of the University of +California, but may be freely redistributed (or sold, or used to line +your birdcage) under the following conditions: /*- - * Copyright (c) 1994 + * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,99 +78,82 @@ o From the original vi acknowledgements, by William Joy and Mark Horton: work on a large number of terminals and Unix systems. o And... - The financial support of UUNET Communications Services is gratefully acknowledged. =-=-=-=-=-=-=-=-=-=-= -o Comments: +o Status: -This software is beta software, although it's pretty stable. Almost -of the necessary functionality for ex/vi is in it, the only missing -pieces are fairly obscure. - -Code fixes are very much appreciated, of course, but if you can't -provide them, please send me as much information as you can as to how -to reproduce the bug, and I'll try to fix it here. In particular, the -screen routines are nasty stuff, and you probably don't want to mess -with them. Stack traces of core dumps are sometimes helpful, but an -example file with a set of keystrokes that causes the problem is far -better. +This software is in beta test, and it's believed to be pretty stable. +Almost all of the historic functionality in ex/vi is there, the missing +pieces are fairly obscure. In particular, the edcompatible, hardtabs*, +lisp*, optimize*, redraw*, and slowopen* options are recognized, but not +implemented. Nvi is mostly 8-bit clean. This isn't difficult to fix, and was left in during initial development to make things easier. Wide character support will be integrated at the same time it is made fully 8-bit clean. -=-=-=-=-=-=-=-=-=-=-= -o New features: - There aren't a lot of new features in nex/nvi, but there are a few things -you might like: - - o 8-bit clean data, practically infinite lines/files. - ^Vx[0-9A-Fa-f]* in input mode will insert any - legal character value. - o Split screens: - :sp[lit] [file ...] splits the screen. - ^W switches between screens. - :resize count grows/shrinks the current screen. - o Background/foreground screens - :bg backgrounds the current screen. - :di[splay] s[creens] lists the hidden screens. - :fg [file] foregrounds the specified (or next) screen. - o Shell screens: - :sc[ript] [file ...] runs a shell in the screen. - Carriage return sends a line to the shell. - o Buffer, screens, tags display: - :di[splay] b[uffers] displays the current cut buffers. - :di[splay] s[creens] displays the hidden screen names. - :di[splay] t[ags] displays the current tags stack. - o Tag stacks: - ^T returns to previous tag location. - :tagpop [number | file] returns to previous tag location, - or, optionally tag #N, or the tag in a specific file. - :tagtop returns to first tag location. - o Infinite undo: - A '.' command immediately after a 'u' command continues - either forward or backward depending on whether the 'u' - command was an undo or a redo. - o Usage information: - :exu[sage] [cmd] for ex commands. - :viu[sage] [key] for vi commands. - :help - o Extended RE expressions: - :set extended turns on extended RE's, so you can - do "/in|or" and search for the next occurrence of - more than one expression. - o Word search: - ^A searches for the word referenced by the cursor. - o Number increment: - # increments the number referenced by the cursor. - o Previous file: - :prev[ious][!] edits the previous file from the - argument list. +you might like. See the "ADDITIONAL FEATURES" section of the manual page +(docs/vi.0.txt, docs/vi.0.ps) for a list. =-=-=-=-=-=-=-=-=-=-= o Porting information: -The directory PORT has directories per machine/OS combination, with -V7-style Makefiles which build nvi. See the file PORT/README for -more detailed information. +The directory PORT has directories per OS/machine combination, with +V7-style Makefiles which build nex/nvi. See the file PORT/README for +detailed information. =-=-=-=-=-=-=-=-=-=-= -o Directories: +o Bug reports: -The main directory, nvi, contains source files for pieces of code that -are shared by all the editors, like searching and logging code or code -translating line numbers into requests to the dbopen(3) database code. -It also has the code for adding, deleting, and changing "records" in -the underlying database. +Code fixes are appreciated, of course, but if you can't provide them, +please email me as much information as you can as to how to reproduce +the bug, and I'll try to fix it locally. In particular, the screen +routines are nasty stuff, and you probably don't want to mess with them. +Stack traces of core dumps are sometimes helpful, but an example file +with a set of keystrokes that causes the problem is far better. Also, +make sure that you include the dimensions of the screen on which the +problem occurred, your startup files (.exrc, .nexrc), and the environment +variable (EXINIT, NEXINIT) values. + +=-=-=-=-=-=-=-=-=-=-= +o Layout: + +nvi: + Source files for pieces of code that are shared by all the + editors, like searching and logging code or code translating + line numbers into requests to the dbopen(3) database code. + It also has the code for adding, deleting, and changing "records" + in the underlying database. + +nvi/PORT: + Porting directories, one per OS/architecture combination. See + nvi/PORT/README for porting information. nvi/docs: - The nvi/docs directory has technical information about data - structures and some of the trickier parts of vi like quoting, - key mapping, input queues, and executing buffers, and a - description of how nvi does edit session recovery. + The nvi/docs directory has all of the nvi documentation: + + README -- Nvi main README file. + USD.doc -- Historic vi documentation (in roff source form). + bugs.current -- Known bugs in the current nvi implementation. + changelog -- Log of changes from version to version. + features -- Todo list, suggested features list. + internals/ + autowrite -- Vi autowrite option discussion. + gdb.script -- GDB debugging scripts. + input -- Vi maps, executable buffers, and input discussion. + quoting -- Vi quoting discussion. + structures -- Nvi internal structure description. + spell.ok -- Misspellings list for README, vi.1. + tutorial -- Historic vi tutorial + vi.0.ps -- PostScript of vi.1. + vi.0.txt -- Flat text of vi.1. + vi.1 -- Nvi man page (in roff source form). + vi.ref -- Nvi reference (in roff source form). + vi.ref.ps -- PostScript of vi.ref. + vi.ref.txt -- Flat text of vi.ref. nvi/ex: The nvi/ex directory is the ex source code. Because vi has the diff --git a/usr.bin/vi/docs/bugs.current b/usr.bin/vi/docs/bugs.current index 1a34dafb3ab5..de2b01a6891d 100644 --- a/usr.bin/vi/docs/bugs.current +++ b/usr.bin/vi/docs/bugs.current @@ -1,5 +1,9 @@ List of known bugs: ++ Large numbers of matches (e.g. %, g or v commands), with the + ignorecase option set, triggers a memory corruption bug in the + regex routines. + + Autoindent doesn't work in the ex editor. + ^C isn't passed to the shell in the script windows as an interrupt @@ -14,7 +18,8 @@ List of known bugs: + The options edcompatible, hardtabs*, lisp*, optimize*, redraw*, and slowopen* are recognized, but not implemented. Options with an asterisk are unlikely to ever be implemented, so if you want - them you might want to say something! + them you might want to say something! I will implement lisp if + anyone ever documents how it really worked. + Screen repainting over slow lines, for some screen changes, is not as good as the historic vi's. @@ -25,13 +30,9 @@ List of known bugs: + If the ex append command is used from vi, the input command buffer is overwritten by the ex_append function, causing random errors. -+ The "b" command stops at every empty line. - + Colon commands longer than a single line cause the display to be incorrect. -+ Left-right scrolling is currently broken. - + When switching files in a small screen (O_WINDOW) with :e, the status message isn't displayed. diff --git a/usr.bin/vi/docs/changelog b/usr.bin/vi/docs/changelog index 671fd5933398..5f1e7fded0ca 100644 --- a/usr.bin/vi/docs/changelog +++ b/usr.bin/vi/docs/changelog @@ -1,4 +1,95 @@ -1.01 -> 1.03: +1.10 -> 1.11: Thu Mar 24 16:07:45 EST 1994 + + Change H, M, and L to set the absolute mark, historical practice. + + Fix bug in stepping through multiple tags files. + + Add "remapmax" option that turns off map counts so you can remap + infinitely. If it's off, term_key() can be interrupted from the + keyboard, which will cause the buffers to flush. I also dropped + the default max number of remaps to 50. (Only Dave Hitz's TM + macros and maze appear to go over that limit.) + + Change :mkexrc to not dump w{300,1200,9600}, lisp options. + + Fix backward search within a line bug. + + Change all the includes of "pathnames.h" to use <>'s so that the + PORT versions can use -I. to replace it with their own versions. + + Make reads and writes interruptible. Rework code that enters and + leaves ex for '!' and filter commands, rework all interrupt and + timer code. + + Fix core dump when user displayed option in .exrc file. + + Fix bug where writing empty files didn't update the saved + modification time. + + Fix bug where /pattern/ addressing was always a backward search. + + Fix bug triggered by autoindent of more than 32 characters, where + nvi wasn't checking the right TEXT length. + + Fix bug where joining only empty lines caused a core dump. +1.09 -> 1.10: Sat Mar 19 15:40:29 EST 1994 + + Fix "set all" core dump. +1.08 -> 1.09: Sat Mar 19 10:11:14 EST 1994 + + If the tag's file path is relative, and it doesn't exist, check + relative to the tag file location. + + Fix ~ command to free temporary buffer on error return. + + Create vi.ref, a first cut at a reference document for vi. + The manual page and the reference document only document the + set options, so far. + + Fix 1G bug not always going to the first non-blank. + + Upgrade PORT/regex to release alpha3.4, from Henry Spencer. + + Add MKS vi's "cdpath" option, supporting a cd search path. + + Handle if search as a motion was discarded, i.e. "d/". + + Change nvi to not create multiple recovery files if modifying + a recovered file. + + Decide to ignore that the cursor is before the '$' when inserting + in list mode. It's too hard to fix. +1.07 -> 1.08: Wed Mar 16 07:37:36 EST 1994 + + Leftright and big line scrolling fixes. This meant more changes + to the screen display code, so there may be new problems. + + Don't permit search-style addresses until a file has been read. + + "c[Ww]" command incorrectly handled the "in whitespace" case. + + Fix key space allocation bug triggered by cut/paste under SunOS. + + Ex move command got the final cursor position wrong. + + Delete "optimize option not implemented" message. + + Make the literal-next character turn off mapping for the next + character in text input mode. +1.06 -> 1.07: Mon Mar 14 11:10:33 EST 1994 + + The "wire down" change in 1.05 broke ex command parsing, there + wasn't a corresponding change to handle multiple K_VLNEXT chars. + + Fix final position for vi's 't' command. +1.05 -> 1.06: Sun Mar 13 16:12:52 EST 1994 + + Wire down ^D, ^H, ^W, and ^V, regardless of the user's termios + values. + + Add ^D as the ex scroll command. + + Support ^Q as a literal-next character. + + Rework abbreviations to be delimited by any !inword() character. + + Add options description to the manual page. + + Minor screen cache fix for svi_get.c. + + Rework beautify option support to match historical practice. + + Exit immediately if not reading from a tty and a command fails. + + Default the SunOS 4.* ports to the distributed curses, not SMI's. +1.04 -> 1.05: Thu Mar 24 16:07:45 EST 1994 + + Make cursor keys work in input mode. + + Rework screen column code in vi curses screen. MAJOR CHANGE -- + after this, we'll be debugging curses screen presentation from + scratch. + + Explode include files in vi.h into the source files. +1.03 -> 1.04: Sun Mar 6 14:14:16 EST 1994 + + Make the ex move command keep the marks on the moved lines. + + Change resize semantics so you can set the screen size to a + specific value. A couple of screen fixes for the resize code. + + Fixes for foreground/background due to SIGWINCH. + + Complete rework of all of vi's cursor movements. The underlying + assumption in the old code was that the starting cursor position + was part of the range of lines cut or deleted. The command + "d[[" is an example where this isn't true. Change it so that all + motion component commands set the final cursor position separately + from the range, as it can't be done correctly later. This is a + MAJOR CHANGE -- after this change, we'll be debugging the cursor + positioning from scratch. + + Rewrite the B, b, E, e commands to use vi's getc() interface + instead of rolling their own. + + Add a second MARK structure, LMARK, which is the larger mark + needed by the logging and mark queue code. Everything else uses + the reworked MARK structure, which is simply a line/column pair. + + Rework cut/delete to not expect 1-past-the-end in the range, but + to act on text to the end of the range, inclusive. + + Sync on write's, to force NFS to flush. +1.01 -> 1.03: Sun Jan 23 17:50:35 EST 1994 (PUBLICLY AVAILABLE VERSION) + Tag stack fixes, was returning to the tag, not the position from which the user tagged. + Only use from the cursor to the end of the word in cursor word @@ -11,17 +102,37 @@ + Fix for multiple error messages if no screen displayed. + Fix :read to set alternate file name as in historical practice. + Fix cut to rotate the numeric buffers if line mode flag set. -1.00 -> 1.01 +1.00 -> 1.01: Wed Jan 12 13:37:18 EST 1994 + Don't put cut items into numeric buffers if cutting less than parts of two lines. -0.94 -> 1.00 +0.94 -> 1.00: Mon Jan 10 02:27:27 EST 1994 + Read-ahead not there; BSD tty driver problem, SunOS curses problem. + Global command could error if it deleted the last line of the file. + Change '.' to only apply to the 'u' if entered immediately - after the 'u' command. "1pu.u.u. is still broken. + after the 'u' command. "1pu.u.u. is still broken, but I + expect that it's going to be sacrificed for multiple undo. + If backward motion on a command, now move to the point; get yank cursor positioning correct. + Rework cut buffers to match historic practice -- yank/delete numeric buffers redone sensibly, ignoring historic practice. +0.92 -> 0.93: Mon Dec 20 19:52:14 EST 1993 + + Christos Zoulas reimplemented the script windows using pty's, + which means that they now work reasonably. The down side of + this is that almost all ports other than 4.4BSD need to include + two new files, login_tty.c and pty.c from the PORT/clib directory. + I've added them to the Makefiles. + + All calloc/malloc/realloc functions now cast their pointers, for + SunOS -- there should be far fewer warning messages, during the + build. The remaining messages are where CHAR_T's meet char *'s, + i.e. where 8-bit clean meets strcmp. + + The user's argument list handling has been reworked so that there + is always a single consistent position for use by :next, :prev and + :rewind. + + All of the historical options are now at least accepted, although + not all of them are implemented. (Edcompatible, hardtabs, lisp, + optimize, redraw, and slowopen aren't implemented.) + + The RE's have been reworked so that matches of length 0 are handled + in the same way as vi used to handle them. + + Several more mapping fixes and ex parser addressing fixes. diff --git a/usr.bin/vi/docs/features b/usr.bin/vi/docs/features new file mode 100644 index 000000000000..ee07857fdab1 --- /dev/null +++ b/usr.bin/vi/docs/features @@ -0,0 +1,47 @@ +List of things that should be added at some point: +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + ++ X11 interface. + ++ Forms editing package; use RE's to verify field contents. + ++ Internationalization, including wide character support. + ++ Make db, curses real libraries that we load against instead of + compiling directly. + ++ Add a ":resize =N" command, that sets the window to a specific + size. + +List of suggested features: +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ++ Change tags to also attempt to find the file using the directory + where it found the tags file. + ++ Add versioning based on a "set version" variable, that would + create backup copies when the file was written back, i.e. the + ":w" and autowrite's would copy the original. + ++ Add "set searchdir" for a list of directories to look in for + files to edit. The semantic is that ":e foo" is replaced with + the file name that is found, so there's no confusion as to + which file is written. + ++ Change + :di[splay] tags -> :tags + :di[splay] screens -> :screens + :di[splay] buffers -> :buffers + ++ A macro record function. Add the ability to record a sequence + of keystrokes into a named buffer for later use. Handy when + you're trying to build a semi-complex macro. + ++ Put multiple messages on a single line if they fit in their entirety, + so that ":n" with autowrite set doesn't force users to hit return to + get see both the "written" and "new file status" messages. + ++ The semantics of :split, :bg, and :fg aren't right. Someone needs to + rethink how they should interact. The main problem arises when users + want to get a window into a new file. Currently, the necessary sequence + is ":split newfile|^W|:bg". It would be nice if you could simply + background the current screen and edit a new one. diff --git a/usr.bin/vi/docs/internals/autowrite b/usr.bin/vi/docs/internals/autowrite new file mode 100644 index 000000000000..55cd13b8f72e --- /dev/null +++ b/usr.bin/vi/docs/internals/autowrite @@ -0,0 +1,88 @@ +# @(#)autowrite 8.2 (Berkeley) 9/28/93 + +Vi autowrite behavior, the fields with *'s are "don't cares". + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Commands that are affected only by autowrite: + +Command File Autowrite? Action: + modified? +----------------------------------------------- +^Z Y Y Write file and suspend. +^Z Y N Suspend. +^Z N * Suspend. + +# This behavior is NOT identical to :edit. +^ Y Y Write file and jump. +^ Y N Error. +^ N * Jump. + +# The new nvi command ^T (:tagpop) behaves identically to ^]. +# This behavior is identical to :tag, :tagpop, and :tagpush with +# force always set to N. +^] Y Y Write file and jump. +^] Y N Error. +^] N * Jump. + +# There's no way to specify a force flag to the '!' command. +:! Y Y Write file and execute. +:! Y N Warn (if warn option) and execute. +:! N * Execute. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Commands that are affected by both autowrite and force: + +NOTE: the "force" flag is never passed on, i.e. the write +to the file caused by the autowrite flag is never forced. + +Command File Autowrite? Force? Action: + modified? (!) +------------------------------------------------------- +# The first rule (YYY) is historic practice, but seems wrong. +# In nvi, :next and :prev commands behave identically to :rewind. +:next Y Y Y Write changes and jump. +:next Y Y N Write changes and jump. +:next Y N Y Abandon changes and jump. +:next Y N N Error. +:next N * * Jump. + +:rewind Y Y Y Abandon changes and jump. +:rewind Y Y N Write changes and jump. +:rewind Y N Y Abandon changes and jump. +:rewind Y N N Error. +:rewind N * * Jump. + +# The new nvi commands, :tagpop and :tagtop, behave identically to :tag. +# Note, this behavior is the same as :rewind and friends, as well. +:tag Y Y Y Abandon changes and jump. +:tag Y Y N Write changes and jump. +:tag Y N Y Abandon changes and jump. +:tag Y N N Error. +:tag N * * Jump. + +# The command :suspend behaves identically to :stop. +:stop Y Y Y Suspend. +:stop Y Y N Write changes and suspend. +:stop Y N Y Suspend. +:stop Y N N Suspend. +:stop N * * Suspend. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Commands that might be affected by autowrite, but aren't: + +Command File Autowrite? Force? Action: + modified? (!) +------------------------------------------------------- +#:ex, and :vi (executed while in vi mode) behave identically to :edit. +:edit Y * Y Abandon changes and jump. +:edit Y * N Error. +:edit N * * Jump. + +:quit Y * Y Quit. +:quit Y * N Error. +:quit N * * Quit. + +:shell * * * Execute shell. + +:xit Y * * Write changes and exit. +:xit N * * Exit. diff --git a/usr.bin/vi/docs/internals/gdb.script b/usr.bin/vi/docs/internals/gdb.script new file mode 100644 index 000000000000..5f180edcd642 --- /dev/null +++ b/usr.bin/vi/docs/internals/gdb.script @@ -0,0 +1,68 @@ +# @(#)gdb.script 8.2 (Berkeley) 9/29/93 + +# display the SVI screen map +# usage dmap(sp) +define dmap + set $h = ((SVI_PRIVATE *)$arg0->svi_private)->h_smap + set $t = ((SVI_PRIVATE *)$arg0->svi_private)->t_smap + while ($h <= $t) + printf "lno: %d; off %d ", (int)$h->lno, (int)$h->off + if ($h->c_ecsize == 0) + printf "flushed\n" + else + printf "\n\tsboff %d; scoff %d\n", \ + (int)$h->c_sboff, (int)$h->c_scoff + printf "\teboff %d; eclen %d; ecsize %d\n", \ + (int)$h->c_eboff, (int)$h->c_eclen, \ + (int)$h->c_ecsize + end + set $h = $h + 1 + end +end + +# display the tail of the SVI screen map +define tmap + set $h = ((SVI_PRIVATE *)$arg0->svi_private)->h_smap + set $t = ((SVI_PRIVATE *)$arg0->svi_private)->t_smap + while ($t >= $h) + printf "lno: %d; off %d ", (int)$t->lno, (int)$t->off + if ($t->c_ecsize == 0) + printf "flushed\n" + else + printf "\n\tsboff %d; scoff %d\n", \ + (int)$t->c_sboff, (int)$t->c_scoff + printf "\teboff %d; eclen %d; ecsize %d\n", \ + (int)$t->c_eboff, (int)$t->c_eclen, \ + (int)$t->c_ecsize + end + set $t = $t - 1 + end +end + +# display the SVI private structure +define svp + print *((SVI_PRIVATE *)sp->svi_private) +end + +# display the marks +define markp + set $h = sp->ep->marks.next + set $t = &sp->ep->marks + while ($h != 0 && $h != $t) + printf "key %c lno: %d cno: %d flags: %x\n", \ + ((MARK *)$h)->name, ((MARK *)$h)->lno, \ + ((MARK *)$h)->cno, ((MARK *)$h)->flags + set $h = ((MARK *)$h)->next + end +end + +# display the tags +define tagp + set $h = sp->taghdr.next + set $t = &sp->taghdr + while ($h != 0 && $h != $t) + printf "tag: %s lno %d cno %d\n", ((TAG *)$h)->frp->fname, \ + ((TAG *)$h)->lno, ((TAG *)$h)->cno + set $h= ((TAG *)$h)->next + end +end diff --git a/usr.bin/vi/docs/internals/input b/usr.bin/vi/docs/internals/input new file mode 100644 index 000000000000..f5aa80c7aa8e --- /dev/null +++ b/usr.bin/vi/docs/internals/input @@ -0,0 +1,314 @@ +# @(#)input 5.4 (Berkeley) 8/26/93 + +MAPS, EXECUTABLE BUFFERS AND INPUT IN EX/VI: + +The basic rule is that input in ex/vi is a stack. Every time a key which +gets expanded is encountered, it is expanded and the expansion is treated +as if it were input from the user. So, maps and executable buffers are +simply pushed onto the stack from which keys are returned. The exception +is that if the "remap" option is turned off, only a single map expansion +is done. I intend to be fully backward compatible with this. + +Historically, if the mode of the editor changed (ex to vi or vice versa), +any queued input was silently discarded. I don't see any reason to either +support or not support this semantic. I intend to retain the queued input, +mostly because it's simpler than throwing it away. + +Historically, neither the initial command on the command line (the + flag) +or the +cmd associated with the ex and edit commands was subject to mapping. +Also, while the +cmd appears to be subject to "@buffer" expansion, once +expanded it doesn't appear to work correctly. I don't see any reason to +either support or not support these semantics, so, for consistency, I intend +to pass both the initial command and the command associated with ex and edit +commands through the standard mapping and @ buffer expansion. + +One other difference between the historic ex/vi and nex/nvi is that nex +displays the executed buffers as it executes them. This means that if +the file is: + + set term=xterm + set term=yterm + set term=yterm + +the user will see the following during a typical edit session: + + nex testfile + testfile: unmodified: line 3 + :1,$yank a + :@a + :set term=zterm + :set term=yterm + :set term=xterm + :q! + +This seems like a feature and unlikely to break anything, so I don't +intend to match historic practice in this area. + +The rest of this document is a set of conclusions as to how I believe +the historic maps and @ buffers work. The summary is as follows: + +1: For buffers that are cut in "line mode", or buffers that are not cut + in line mode but which contain portions of more than a single line, a + trailing character appears in the input for each line in the + buffer when it is executed. For buffers not cut in line mode and which + contain portions of only a single line, no additional characters + appear in the input. +2: Executable buffers that execute other buffers don't load their + contents until they execute them. +3: Maps and executable buffers are copied when they are executed -- + they can be modified by the command but that does not change their + actions. +4: Historically, executable buffers are discarded if the editor + switches between ex and vi modes. +5: Executable buffers inside of map commands are expanded normally. + Maps inside of executable buffers are expanded normally. +6: If an error is encountered while executing a mapped command or buffer, + the rest of the mapped command/buffer is discarded. No user input + characters are discarded. + +Individual test cases follow. Note, in the test cases, control characters +are not literal and will have to be replaced to make the test cases work. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +1: For buffers that are cut in "line mode", or buffers that are not cut + in line mode but which contain portions of more than a single line, a + trailing character appears in the input for each line in the + buffer when it is executed. For buffers not cut in line mode and which + contain portions of only a single line, no additional characters + appear in the input. + +=== test file === +3Gw +w +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +=== end test file === + + If the first line is loaded into 'a' and executed: + +1G"ayy@a + + The cursor ends up on the '2', a result of pushing "3Gw^J" onto + the stack. + + If the first two lines are loaded into 'a' and executed: + +1G2"ayy@a + + The cursor ends up on the 'f' in "foo" in the fifth line of the + file, a result of pushing "3Gw^Jw^J" onto the stack. + + If the first line is loaded into 'a', but not using line mode, + and executed: + +1G"ay$@a + + The cursor ends up on the '1', a result of pushing "3Gw" onto + the stack + + If the first two lines are loaded into 'a', but not using line mode, + and executed: + +1G2"ay$@a + + The cursor ends up on the 'f' in "foo" in the fifth line of the + file, a result of pushing "3Gw^Jw^J" onto the stack. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +2: Executable buffers that execute other buffers don't load their + contents until they execute them. + +=== test file === +cwLOAD B^[ +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +@a@b +"byy +=== end test file === + + The command is loaded into 'e', and then executed. 'e' executes + 'a', which loads 'b', then 'e' executes 'b'. + +5G"eyy6G"ayy1G@e + + The output should be: + +=== output file === +cwLOAD B^[ +LOAD B 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +@a@b +"byy +=== end output file === + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +3: Maps and executable buffers are copied when they are executed -- + they can be modified by the command but that does not change their + actions. + + Executable buffers: + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +@a@b +"eyy +cwEXECUTE B^[ +=== end test file === + +4G"eyy5G"ayy6G"byy1G@eG"ep + + The command is loaded into 'e', and then executed. 'e' executes + 'a', which loads 'e', then 'e' executes 'b' anyway. + + The output should be: + +=== output file === +line 1 foo bar baz +EXECUTE B 2 foo bar baz +line 3 foo bar baz +@a@b +"eyy +cwEXECUTE B^[ +line 1 foo bar baz +=== end output file === + + Maps: + +=== test file === +Cine 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +=== end test file === + + Entering the command ':map = :map = rB^V^MrA^M1G==' shows that + the first time the '=' is entered the '=' map is set and the + character is changed to 'A', the second time the character is + changed to 'B'. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +4: Historically, executable buffers are discarded if the editor + switches between ex and vi modes. + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +cwCHANGE^[Q:set +set|visual|1Gwww +=== end test file === + +vi testfile +4G"ayy@a + +ex testfile +$p +yank a +@a + + In vi, the command is loaded into 'a' and then executed. The command + subsequent to the 'Q' is (historically, silently) discarded. + + In ex, the command is loaded into 'a' and then executed. The command + subsequent to the 'visual' is (historically, silently) discarded. The + first set command is output by ex, although refreshing the screen usually + causes it not to be seen. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +5: Executable buffers inside of map commands are expanded normally. + Maps inside of executable buffers are expanded normally. + + Buffers inside of map commands: + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +cwREPLACE BY A^[ +=== end test file === + +4G"ay$:map x @a +1Gx + + The output should be: + +=== output file === +REPLACE BY A 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +cwREPLACE BY A^[ +=== end output file === + + Maps commands inside of executable buffers: + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +X +=== end test file === + +:map X cwREPLACE BY XMAP^[ +4G"ay$1G@a + + The output should be: + +=== output file === +REPLACE BY XMAP 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +X +=== end output file === + + Here's a test that does both, repeatedly. + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +X +Y +cwREPLACED BY C^[ +blank line +=== end test file === + +:map x @a +4G"ay$ +:map X @b +5G"by$ +:map Y @c +6G"cy$ +1Gx + + The output should be: + +=== output file === +REPLACED BY C 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +X +Y +cwREPLACED BY C^[ +blank line +=== end output file === + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +6: If an error is encountered while executing a mapped command or + a buffer, the rest of the mapped command/buffer is discarded. No + user input characters are discarded. + +=== test file === +line 1 foo bar baz +line 2 foo bar baz +line 3 foo bar baz +:map = 10GcwREPLACMENT^V^[^[ +=== end test file === + + The above mapping fails, however, if the 10G is changed to 1, 2, + or 3G, it will succeed. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/usr.bin/vi/docs/internals/quoting b/usr.bin/vi/docs/internals/quoting new file mode 100644 index 000000000000..f20bd3f2b1e9 --- /dev/null +++ b/usr.bin/vi/docs/internals/quoting @@ -0,0 +1,219 @@ +# @(#)quoting 5.4 (Berkeley) 8/20/93 + +QUOTING IN EX/VI: + +There are two escape characters in historic ex/vi, ^V (or whatever +character the user specified as their literal next character) and +backslashes. There are two different areas in ex/vi where escaping +is interesting: the command and text input modes, and within the ex +commands themselves. In the examples below, ^V is used as the +typical literal next character. + +1: Escaping characters in ex and vi command and text input modes. + The set of characters that users might want to escape are as + follows: + + vi text input mode (a, i, o, etc.): + + carriage return (^M) + escape (^[) + autoindent characters + (^D, 0, ^, ^T) + erase, word erase, and line erase + (^H, ^W, ^U) + newline (^J) (not historic practice) + suspend (^Z) (not historic practice) + repaint (^L) (not historic practice) + + vi command line (:colon commands): + + carriage return (^M) + escape (^[) + erase, word erase, and line erase + (^H, ^W, ^U) + newline (^J) (not historic practice) + suspend (^Z) (not historic practice) + repaint (^L) (not historic practice) + + ex text input mode (a, i, o, etc.): + + carriage return (^M) + erase, word erase, and line erase + (^H, ^W, ^U) + newline (^J) (not historic practice) + + ex command line: + + carriage return (^M) + erase, word erase, and line erase + (^H, ^W, ^U) + newline (^J) (not historic practice) + suspend (^Z) + + I intend to follow historic practice for all of these cases, which + was that ^V was the only way to escape any of these characters, and + that whatever character followed the ^V was taken literally, i.e. + ^V^V is a single ^V. + + The historic ex/vi disallowed the insertion of various control + characters (^D, ^T, whatever) during various different modes, or, + permitted the insertion of only a single one, or lots of other random + behaviors (you can use ^D to enter a command in ex). I have + regularized this behavior in nvi, there are no characters that cannot + be entered or which have special meaning other than the ones listed + above. + + One comment regarding the autoindent characters. In historic vi, + if you entered "^V0^D" autoindent erasure was still triggered, + although it wasn't if you entered "0^V^D". In nvi, if you escape + either character, autoindent erasure is not triggered. + + This doesn't permit whitespace in command names, but that wasn't + historic practice and doesn't seem worth doing. + + Fun facts to know and tell: + The historic vi implementation for the 'r' command requires + *three* ^V's to replace a single character with ^V. + +2: Ex commands: + + Ex commands are delimited by '|' or newline characters. Within + the commands, whitespace characters delimit the arguments. + + I intend to treat ^V, followed by any character, as that literal + character. + + This is historic behavior in vi, although there are special + cases where it's impossible to escape a character, generally + a whitespace character. + +3: Escaping characters in file names in ex commands: + + :cd [directory] (directory) + :chdir [directory] (directory) + :edit [+cmd] [file] (file) + :ex [+cmd] [file] (file) + :file [file] (file) + :next [file ...] (file ...) + :read [!cmd | file] (file) + :source [file] (file) + :write [!cmd | file] (file) + :wq [file] (file) + :xit [file] (file) + + I intend to treat a backslash in a file name, followed by any + character, as that literal character. + + This is historic behavior in vi. + + In addition, since file names are also subject to word expansion, + the rules for escape characters in section 3 of this document also + apply. This is NOT historic behavior in vi, making it impossible + to insert a whitespace, newline or carriage return character into + a file name. This change could cause a problem if there were files + with ^V's in their names, but I think that's unlikely. + +4: Escaping characters in non-file arguments in ex commands: + + :abbreviate word string (word, string) +* :edit [+cmd] [file] (+cmd) +* :ex [+cmd] [file] (+cmd) + :k key (key) + :map word string (word, string) + :mark key (key) +* :set [option ...] (option) +* :tag string (string) + :unabbreviate word (word) + :unmap word (word) + + These commands use whitespace to delimit their arguments, and use + ^V to escape those characters. The exceptions are starred in the + above list, and are discussed below. + + In general, I intend to treat a ^V in any argument, followed by + any character, as that literal character. This will permit + editing of files name "foo|", for example, by using the string + "foo\^V|", where the literal next character protects the pipe + from the ex command parser and the backslash protects it from the + shell expansion. + + This is backward compatible with historical vi, although there + were a number of special cases where vi wasn't consistent. + +4.1: The edit/ex commands: + + The edit/ex commands are a special case because | symbols may + occur in the "+cmd" field, for example: + + :edit +10|s/abc/ABC/ file.c + + In addition, the edit and ex commands have historically ignored + literal next characters in the +cmd string, so that the following + command won't work. + + :edit +10|s/X/^V / file.c + + I intend to handle the literal next character in edit/ex consistently + with how it is handled in other commands. + + More fun facts to know and tell: + The acid test for the ex/edit commands: + + date > file1; date > file2 + vi + :edit +1|s/./XXX/|w file1| e file2|1 | s/./XXX/|wq + + No version of vi, of which I'm aware, handles it. + +4.2: The set command: + + The set command treats ^V's as literal characters, so the following + command won't work. Backslashes do work in this case, though, so + the second version of the command does work. + + set tags=tags_file1^V tags_file2 + set tags=tags_file1\ tags_file2 + + I intend to continue permitting backslashes in set commands, but + to also permit literal next characters to work as well. This is + backward compatible, but will also make set consistent with the + other commands. I think it's unlikely to break any historic + .exrc's, given that there are probably very few files with ^V's + in their name. + +4.3: The tag command: + + The tag command ignores ^V's and backslashes; there's no way to + get a space into a tag name. + + I think this is a don't care, and I don't intend to fix it. + +5: Regular expressions: + + :global /pattern/ command + :substitute /pattern/replace/ + :vglobal /pattern/ command + + I intend to treat a backslash in the pattern, followed by the + delimiter character or a backslash, as that literal character. + + This is historic behavior in vi. It would get rid of a fairly + hard-to-explain special case if we could just use the character + immediately following the backslash in all cases, or, if we + changed nvi to permit using the literal next character as a + pattern escape character, but that would probably break historic + scripts. + + There is an additional escaping issue for regular expressions. + Within the pattern and replacement, the '|' character did not + delimit ex commands. For example, the following is legal. + + :substitute /|/PIPE/|s/P/XXX/ + + This is a special case that I will support. + +6: Ending anything with an escape character: + + In all of the above rules, an escape character (either ^V or a + backslash) at the end of an argument or file name is not handled + specially, but used as a literal character. diff --git a/usr.bin/vi/docs/internals/structures b/usr.bin/vi/docs/internals/structures new file mode 100644 index 000000000000..d49ab65cbeed --- /dev/null +++ b/usr.bin/vi/docs/internals/structures @@ -0,0 +1,61 @@ +# @(#)structures 5.2 (Berkeley) 11/1/93 + +There are three major data structures in this package. The first is a +single global structure (named GS) which contains information common to +all files and screens. It's really pretty tiny, and functions more as a +single place to hang things than anything else. + +The second and third structures are the file structures (named EXF) and +the screen structures (named SCR). They contain information theoretically +unique to a screen or file, respectively. Each SCR structure has a set +of functions which update the screen and/or return information about the +screen from the underlying screen package. + +The GS structure contains linked lists SCR structures. The structures +can also be classed by persistence. The GS structure never goes away +and the SCR structure persists over instances of files. + +File names have different properties than files themselves, so the name +information for a file is held in an FREF structure which is chained from +the SCR structure. + +In general, functions are always passed an SCR structure and often an EXF +structure as well. The SCR structure is necessary for any routine that +wishes to talk to the screen, the EXF structure is necessary for any +routine that wants to modify the file. The relationship between an SCR +structure and its underlying EXF structure is not fixed, and although you +can translate from an SCR to the underlying EXF, it is discouraged. If +this becomes too onerous, I suspect I'll just stop passing around the EXF +in the future. + +The naming of the structures is consistent across the program. (Macros +even depend on it, so don't try and change it!) The global structure is +"gp", the screen structure is "sp", and the file structure is "ep". + +A few other data structures: + +TEXT In nvi/cut.h. This structure describes a portion of a line, + and is used by the input routines and as the "line" part of a + cut buffer. + +CB In nvi/cut.h. A cut buffer. A cut buffer is a place to + hang a list of TEXT structures. + +MARK In nvi/mark.h. A cursor position, consisting of a line number + and a column number. + +MSG In nvi/msg.h. A chain of messages for the user. + +SEQ In nvi/seq.h. An abbreviation or a map entry. + +EXCMDARG + In nvi/ex/excmd.h.stub. The structure that gets passed around + to the functions that implement the ex commands. (The main + ex command loop (see nvi/ex/ex.c) builds this up and then passes + it to the ex functions.) + +VICMDARG + In nvi/vi/vcmd.h. The structure that gets passed around to the + functions that implement the vi commands. (The main vi command + loop (see nvi/vi/vi.c) builds this up and then passes it to the + vi functions.) diff --git a/usr.bin/vi/docs/set.opt.roff b/usr.bin/vi/docs/set.opt.roff new file mode 100644 index 000000000000..e39dc810d1d7 --- /dev/null +++ b/usr.bin/vi/docs/set.opt.roff @@ -0,0 +1,1065 @@ +.\" Copyright (c) 1994 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)set.opt.roff 8.5 (Berkeley) 3/22/94 +.\" +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. +#ifdef REFERENCE +(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 +.Nm nex/nvi . +Historically, only the full name and the official abbreviations +were accepted by +.Nm ex/vi . +Using full names in your startup files and environmental variables will +probably make them more portable.) +#endif +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 +.Nm \&ex +and +.Nm \&vi +modes, unless otherwise specified. +#ifdef REFERENCE +.Pp +For information on modifying the options or to display the options and +their current values, see the +.Dq set +command in the Ex Commands section. +#endif +.Bl -tag -width "XXXX" -compact +.It Li "altwerase [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Select an alternate word erase algorithm. +#endif +#ifdef REFERENCE +Change how +.Nm \&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 non-blank +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). +#endif +.It Li "autoindent, ai [off]" +#ifdef MANUAL +Automatically indent new lines. +#endif +#ifdef REFERENCE +If this option is set, whenever you create a new line (using the +.Nm \&vi +.Sy \&A , +.Sy \&a , +.Sy \&C , +.Sy \&c , +.Sy \&I , +.Sy \&i , +.Sy \&O , +.Sy \&o , +.Sy \&R , +.Sy \&r , +.Sy \&S , +and +.Sy \&s +commands, or the +.Nm \&ex +.Sy append , +.Sy change , +and +.Sy insert +commands) the new line is automatically indented to align the cursor with +the first non-blank 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 +.Sy 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 non-blank character +to the right of the cursor is aligned as described above. +.Pp +The indent characters are themselves somewhat special. +If you do not enter more characters on the new line before moving moving to +another line, or entering , the indent character will be deleted and +the line will be empty. +For example, if you enter twice in succession, the line +created by the first will not have any characters in it, +regardless of the indentation of the previous or subsequent line. +.Pp +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 + 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 +.Sy \&^D +key would erase the indent characters. +Both the +.Sy \&^D +key and the usual erase keys work in +.Nm nvi .) +In addition, if the cursor is positioned at the end of the indent +characters, the keys +.Dq 0^D +will erase all of the indent characters for the current line, +resetting the indentation level to 0. +Similarly, the keys +.Dq ^^D +(i.e. a carat followed by a ) will erase all of the indent +characters for the current line, leaving the indentation level for +future created lines unaffected. +.Pp +Finally, if +.Sy autoindent +is set, the +.Sy \&S +and +.Sy \&cc +commands change from the first non-blank of the line to the end of the +line, instead of from the beginning of the line to the end of the line. +#endif +.It Li "autoprint, ap [off]" +.Nm \&Ex +only. +#ifdef MANUAL +Display the current line automatically. +. +#endif +#ifdef REFERENCE +.Nm \&Ex +only. +Cause the current line to be automatically displayed after the +.Nm \&ex +commands +.Sy \&< , +.Sy \&> , +.Sy copy , +.Sy delete , +.Sy join , +.Sy move , +.Sy put , +.Sy \&t , +.Sy Undo , +and +.Sy undo . +This automatic display is suppressed during +.Sy global +and +.Sy vglobal +commands, and for any command where optional flags are used to explicitly +display the line. +#endif +.It Li "autowrite, aw [off]" +#ifdef MANUAL +Write modified files automatically when changing files. +#endif +#ifdef REFERENCE +If this option is set, the +.Nm \&vi +.Sy \&! +.Sy \&^^ +.Sy \&^] +and +.Sy \&^Z +commands, and the +.Nm \&ex +.Sy edit , +.Sy next , +.Sy rewind , +.Sy stop , +.Sy suspend , +.Sy tag , +.Sy tagpop , +and +.Sy 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. +.Pp +Appending the optional force flag +.Dq \&! +to the +.Nm \&ex +commands +.Sy next , +.Sy rewind , +.Sy stop , +.Sy suspend , +.Sy tag , +.Sy tagpop , +and +.Sy tagtop +stops the automatic write from being attempted. +.Pp +(Historically, the +.Sy next +command ignored the optional force flag.) +Note, the +.Nm \&ex +commands +.Sy edit , +.Sy quit , +.Sy shell , +and +.Sy xit +are +.Em not +affected by the +.Sy autowrite +option. +#endif +.It Li "beautify, bf [off]" +#ifdef MANUAL +Discard control characters. +#endif +#ifdef REFERENCE +If this option is set, all control characters that are not currently being +specially interpreted, other than , , and , are +discarded from commands read in by +.Nm \&ex +from command files, and from input text entered to +.Nm \&vi +(either into the file or to the colon command line). +Text files read by +.Nm ex/vi +are +.Em not +affected by the +.Sy beautify +option. +#endif +.It Li "cdpath [environment variable CDPATH, or ``.'']" +#ifdef MANUAL +The directory paths used as path prefixes for the +.Sy cd +command. +#endif +#ifdef REFERENCE +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 +.Sy cd +command. +The value of this option defaults to the value of the environmental +variable +.Ev CDPATH +if it is set, otherwise to the current directory. +For compatibility with the POSIX 1003.2 shell, the +.Sy cd +command does +.Em 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 +.Dq \&. +into the +.Ev CDPATH +variable or the option value. +#endif +.It Li "columns, co [80]" +#ifdef MANUAL +Set the number of columns in the screen. +#endif +#ifdef REFERENCE +The number of columns in the screen. +Setting this option causes +.Nm ex/vi +to set (or reset) the environmental variable +.Ev COLUMNS . +See the SCREEN SIZING section for more information. +#endif +.It Li "comment [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Skip leading comments in files. +#endif +#ifdef REFERENCE +If the first non-empty line of the file begins with the string +.Dq \&/\&* , +this option causes +.Nm \&vi +to skip to the end of that C comment (probably a terribly boring +legal notice) before displaying the file. +#endif +.It Li "directory, dir [environment variable TMPDIR, or /tmp]" +#ifdef MANUAL +The directory where temporary files are created. +#endif +#ifdef REFERENCE +The directory where temporary files are created. +The environmental variable +.Ev TMPDIR +is used as the default value if it exists, otherwise +.Pa /tmp +is used. +#endif +.It Li "edcompatible, ed [off]" +#ifdef MANUAL +Modify the behavior of certain suffices for the +.Nm ex +.Sy substitute +command. +#endif +#ifdef REFERENCE +This option causes the presence or absence of +.Sy \&g +and +.Sy \&c +suffixes on +.Sy substitute +commands to be remembered, +and to be toggled by repeating the suffices. +The suffix +.Sy \&r +makes the substitution be as in the +.Sy \&~ +command, instead of like the +.Sy \&& +command. +#endif +.br +.Em "This option is not yet implemented." +.It Li "errorbells, eb [off]" +.Nm \&Ex +only. +#ifdef MANUAL +Precede error messages with a bell. +#endif +#ifdef REFERENCE +Causes +.Nm \&ex +error messages to be preceded by a bell. +#endif +.br +.Em "This option is not yet implemented." +.It Li "exrc, ex [off]" +#ifdef MANUAL +Never read startup files in the local directory. +#endif +#ifdef REFERENCE +If this option is turned off in the system or $HOME startup files, +the local startup files are never read (unless they are the same +as the system or $HOME startup files). +Turning it on has no effect, i.e. the normal checks for local startup +files are performed, regardless. +See the STARTUP INFORMATION section for more information. +#endif +.It Li "extended [off]" +#ifdef MANUAL +Regular expressions are extended (i.e. +.Xr egrep 1 +style) expressions. +#endif +#ifdef REFERENCE +This option causes all regular expressions to be treated as POSIX +1003.2 extended regular expressions (which are similar to historic +.Xr egrep 1 +style expressions). +#endif +.It Li "flash [on]" +#ifdef MANUAL +Flash the screen instead of beeping the keyboard on error. +#endif +#ifdef REFERENCE +This option causes the screen to flash instead of beeping the keyboard, +on error, if the terminal has the capability. +#endif +.It Li "hardtabs, ht [8]" +#ifdef MANUAL +Set the spacing between hardware tab settings. +#endif +#ifdef REFERENCE +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 +.Nm nex/nvi +never writes tabs to the terminal, unlike historic versions of +.Nm ex/vi , +this option does not currently have any affect. +#endif +.It Li "ignorecase, ic [off]" +#ifdef MANUAL +Ignore case differences in regular expressions. +#endif +#ifdef REFERENCE +This option causes regular expressions, both in +.Nm \&ex +commands and in searches, +to be evaluated in a case-insensitive manner. +#endif +.It Li "keytime [6]" +The 10th's of a second +.Nm ex/vi +waits for a subsequent key to complete a key mapping. +.It Li "leftright [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Do left-right scrolling. +#endif +#ifdef REFERENCE +This option causes the screen to be scrolled left-right to view +lines longer than the screen, instead of the traditional +.Nm \&vi +screen interface which folds long lines at the right-hand margin +of the terminal. +#endif +.It Li "lines, li [24]" +.Nm \&Vi +only. +#ifdef MANUAL +Set the number of lines in the screen. +#endif +#ifdef REFERENCE +The number of lines in the screen. +Setting this option causes +.Nm ex/vi +to set (or reset) the environmental variable +.Ev LINES . +See the Screen Sizing section for more information. +#endif +.It Li "lisp [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Modify various search commands and options to work with Lisp. +#endif +#ifdef REFERENCE +This option changes the behavior of the +.Nm \&vi +.Sy \&( , +.Sy \&) , +.Sy \&{ , +.Sy \&} , +.Sy \&[[ +and +.Sy \&]] +commands to match the Lisp language. +Also, the +.Sy autoindent +option's behavior is changed to be appropriate for Lisp. +#endif +.br +.Em "This option is not yet implemented." +.It Li "list [off]" +#ifdef MANUAL +Display lines in an unambiguous fashion. +#endif +#ifdef REFERENCE +This option causes lines to be displayed in an unambiguous fashion. +Specifically, tabs are displayed as control characters, i.e. +.Dq \&^I , +and the ends of lines are marked with a +.Dq \&$ +character. +#endif +.It Li "magic [on]" +#ifdef MANUAL +Treat certain characters specially in regular expressions. +#endif +#ifdef REFERENCE +This option is on by default. +Turning the +.Sy magic +option off causes all regular expression characters except for +.Dq \&^ +and +.Dq \&$ , +to be treated as ordinary characters. +To re-enable characters individually, when the +.Sy magic +option is off, +precede them with an +.Dq \&\e . +See the REGULAR EXPRESSIONS AND REPLACEMENT STRINGS section for +more information. +#endif +.It Li "matchtime [7]" +.Nm \&Vi +only. +The 10th's of a second +.Nm ex/vi +pauses on the matching character when the +.Sy showmatch +option is set. +.It Li "mesg [on]" +#ifdef MANUAL +Permit messages from other users. +#endif +#ifdef REFERENCE +This option allows other users to contact you using the +.Xr talk 1 +and +.Xr write 1 +utilities, while you are editing. +.Nm 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 +utility for more information. +#endif +.It Li "modelines, modeline [off]" +#ifdef MANUAL +Read the first and last few lines of each file for +.Nm ex +commands. +#endif +#ifdef REFERENCE +If the +.Sy modelines +option is set, +.Nm ex/vi +has historically scanned the first and last five lines of each file as +it is read for editing, looking for any +.Nm \&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. +Commands are recognized by the letters +.Dq \&e +or +.Dq \&v +followed by +.Dq \&x +or +.Dq \&i , +at the beginning of a line or following a tab or space character, +and followed by a +.Dq \&: , +an +.Nm \&ex +command, and another +.Dq \&: . +This option is a security problem of immense proportions, +and should not be used under any circumstances. +#endif +.br +.Em "This option will never be implemented." +.It Li "number, nu [off]" +Precede each line displayed with its current line number. +.It Li "open [on]" +.Nm \&Ex +only. +If this option is not set, the +.Sy open +and +.Sy visual +commands are disallowed. +.It Li "optimize, opt [on]" +.Nm \&Vi +only. +#ifdef MANUAL +Optimize text throughput to dumb terminals. +#endif +#ifdef REFERENCE +Throughput of text is expedited by setting the terminal to no 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. +#endif +.br +.Em "This option is not yet implemented." +.It Li "paragraphs, para [IPLPPPQPP LIpplpipbp]" +.Nm \&Vi +only. +Define additional paragraph boundaries for the +.Sy \&{ +and +.Sy \&} +commands. +#ifdef REFERENCE +The value of this option must be a character string consisting +of zero or more character pairs. +.Pp +In the text to be edited, the character string ., +(where is one of the character pairs in the option's value) +defines a paragraph boundary. +For example, if the option were set to +.Dq "LaA ##" , +then all of the following additional paragraph boundaries would be +recognized: +.Bd -literal -offset indent -compact +.La +.A +.## +.Ed +#endif +.It Li "prompt [on]" +.Nm \&Ex +only. +#ifdef MANUAL +Display a command prompt. +#endif +#ifdef REFERENCE +This option causes +.Nm \&ex +to prompt for command input with a +.Dq \&: +character; when it's not set, no prompt is displayed. +#endif +.It Li "readonly, ro [off]" +#ifdef MANUAL +Mark the file as read-only. +#endif +#ifdef REFERENCE +This option causes a force flag to be required to attempt to write +the file back to the original file name. +Setting this option is equivalent to using the +.Fl R +command line option, or editing a file which lacks write permission. +#endif +.It Li "recdir [/var/tmp/vi.recover]" +The directory where recovery files are stored. +.It Li "redraw, re [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Simulate an intelligent terminal on a dumb one. +#endif +#ifdef REFERENCE +The editor simulates (using great amounts of output), an intelligent +terminal on a dumb terminal (e.g. during insertions in visual mode +the characters to the right of the cursor are refreshed as each input +character is typed). +#endif +.br +.Em "This option is not yet implemented." +.It Li "remap [on]" +#ifdef MANUAL +Remap keys until resolved. +#endif +#ifdef REFERENCE +If this option is set, +it's possible to define macros in terms of other macros. +Otherwise, each key is only remapped up to one time. +For example, if +.Dq \&A +is mapped to +.Dq \&B , +and +.Dq \&B +is mapped to +.Dq \&C , +The keystroke +.Dq \&A +will be mapped to +.Dq \&C +if +.Sy remap +is set, and to +.Dq \&B +if it is not set. +#endif +.It Li "remapmax [on]" +#ifdef MANUAL +Limit the number of times a key may be remapped. +#endif +#ifdef REFERENCE +If this option is set, a key may only be remapped 50 times. +If it is not set, a key may be remapped an infinite number of times, +and the editor can be placed into infinite loops. +#endif +.It Li "report [5]" +#ifdef MANUAL +Set the number of lines about which the editor reports changes. +#endif +#ifdef REFERENCE +Set the threshold of the number of lines that need to be changed +before a message will be displayed to the user. +The value is the largest value about which the editor is silent, +i.e. by default, 6 lines must change before the user is notified. +#endif +.It Li "ruler [off]" +.Nm \&Vi +only. +Display a row/column ruler on the colon command line. +.It Li "scroll, scr [window / 2]" +#ifdef MANUAL +Set the number of lines scrolled. +#endif +#ifdef REFERENCE +Set the number of lines scrolled by the +.Nm \&vi +commands +.Sy \&^D +and +.Sy \&^U . +.Pp +Historically, the +.Nm ex +.Sy 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. +#endif +.It Li "sections, sect [NHSHH HUnhsh]" +.Nm \&Vi +only. +Define additional section boundaries for the +.Sy \&[[ +and +.Sy \&]] +commands. +#ifdef REFERENCE +The +.Sy 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 ., +(where is one of the character pairs in the option's value), +defines a section boundary in the same manner that +.Sy paragraph +option boundaries are defined. +#endif +.It Li "shell, sh [environment variable SHELL, or /bin/sh]" +Select the shell used by the editor. +#ifdef REFERENCE +The specified path is the pathname of the shell invoked by the +.Nm \&vi +.Sy \&! +shell escape command and by the +.Nm \&ex +.Sy shell +command. +This program is also used to resolve any shell meta-characters in +.Nm \&ex +commands. +#endif +.It Li "shiftwidth, sw [8]" +Set the autoindent and shift command indentation width. +#ifdef REFERENCE +This width is used by the +.Sy autoindent +option and by the +.Sy \&< , +.Sy \&> , +and +.Sy shift +commands. +#endif +.It Li "showdirty [off]" +.Nm \&Vi +only. +Display an asterisk on the colon command line if the file has been modified. +.It Li "showmatch, sm [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Note matching +.Dq \&{ +and +.Dq \&( +for +.Dq \&} +and +.Dq \&) +characters. +#endif +#ifdef REFERENCE +This option causes +.Nm \&vi , +when a +.Dq \&} +or +.Dq \&) +is entered, to briefly move the cursor the matching +.Dq \&{ +or +.Dq \&( . +See the +.Sy matchtime +option for more information. +#endif +.It Li "showmode [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Display the current editor mode (command or input). +#endif +#ifdef REFERENCE +This option causes +.Nm \&vi +to display the strings +.Dq Command +or +.Dq Input +on the colon command line, based on the current mode of the editor. +#endif +.It Li "sidescroll [16]" +.Nm \&Vi +only. +#ifdef MANUAL +Set the amount a left-right scroll will shift. +#endif +#ifdef REFERENCE +Sets the number of columns that are shifted to the left or right, +when +.Nm \&vi +is doing left-right scrolling and the left or right margin is +crossed. +See the +.Sy leftright +option for more information. +#endif +.It Li "slowopen, slow [off]" +#ifdef MANUAL +Delay display updating during text input. +#endif +#ifdef REFERENCE +This option affects the display algorithm used by +.Nm \&vi , +holding off display updating during input of new text to improve +throughput when the terminal in use is slow and unintelligent. +#endif +.br +.Em "This option is not yet implemented." +.It Li "sourceany [off]" +#ifdef MANUAL +Read startup files not owned by the current user. +#endif +#ifdef REFERENCE +If this option is turned on, +.Nm \&vi +historically read startup files that were owned by someone other than +the editor user. +See the STARTUP INFORMATION section for more information. +This option is a security problem of immense proportions, +and should not be used under any circumstances. +#endif +.br +.Em "This option will never be implemented." +.It Li "tabstop, ts [8]" +This option sets tab widths for the editor display. +.It Li "taglength, tl [0]" +#ifdef MANUAL +Set the number of significant characters in tag names. +#endif +#ifdef REFERENCE +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. +#endif +.It Li "tags, tag [tags /var/db/libc.tags /sys/kern/tags]" +#ifdef MANUAL +Set the list of tags files. +#endif +#ifdef REFERENCE +Sets the list of tags files, in search order, +which are used when the editor searches for a tag. +#endif +.It Li "term, ttytype, tty [environment variable TERM]" +Set the terminal type. +#ifdef REFERENCE +Setting this option causes +.Nm ex/vi +to set (or reset) the environmental variable +.Ev TERM . +#endif +.It Li "terse [off]" +This option has historically made editor messages less verbose. +It has no effect in this implementation. +#ifdef REFERENCE +See the +.Sy verbose +option for more information. +#endif +.It Li "timeout, to [on]" +#ifdef MANUAL +Time out on keys which may be mapped. +#endif +#ifdef REFERENCE +If this option is set, +.Nm ex/vi +waits for a specific period for a subsequent key to complete a key +mapping (see the +.Sy 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. +#endif +.It Li "ttywerase [off]" +.Nm \&Vi +only. +#ifdef MANUAL +Select an alternate erase algorithm. +#endif +#ifdef REFERENCE +This option changes how +.Nm \&vi +does word erase during text input. +If this option is set, text is broken up into two classes, +blank characters and non-blank characters. +Changing from one class to another marks the end of a word. +#endif +.It Li "verbose [off]" +.NM \&Vi +only. +#ifdef MANUAL +Display an error message for every error. +#endif +#ifdef REFERENCE +.Nm \&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. +#endif +.It Li "w300 [no default]" +.Nm \&Vi +only. +Set the window size if the baud rate is less than 1200 baud. +#ifdef REFERENCE +See the +.Sy window +option for more information. +#endif +.It Li "w1200 [no default]" +.Nm \&Vi +only. +Set the window size if the baud rate is equal to 1200 baud. +#ifdef REFERENCE +See the +.Sy window +option for more information. +#endif +.It Li "w9600 [no default]" +.Nm \&Vi +only. +Set the window size if the baud rate is greater than 1200 baud. +#ifdef REFERENCE +See the +.Sy window +option for more information. +#endif +.It Li "warn [on]" +.Nm \&Ex +only. +This option causes a warning message to the terminal if the file has +been modified, since it was last written, before a +.Sy \&! +command. +.It Li "window, w, wi [environment variable LINES]" +#ifdef MANUAL +Set the window size for the screen. +#endif +#ifdef REFERENCE +This option determines the default number of lines in a screenful, +as written by the +.Sy \&z +command. +It also determines the number of lines scrolled by the +.Nm \&vi +commands +.Sy \&^F +and +.Sy \&^B . +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 SCREEN SIZING section). +Setting the value of the +.Sy window +option is the same as using the +.Fl w +command line option. +.Pp +If the value of +.Sy window +(as set by the +.Sy window , +.Sy w300 , +.Sy w1200 +or +.Sy 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. +(Further movements in that same area will result in the screen being +filled.) +This can provide a performance improvement when viewing different +places in one or more files over a slow link. +#endif +.It Li "wrapmargin, wm [0]" +.Nm \&Vi +only. +#ifdef MANUAL +Break lines automatically when they reach the right-hand margin. +#endif +#ifdef REFERENCE +If the value of wrapmargin is non-zero, +.Nm \&vi +will break lines, that are more than that number of characters long, +into two lines at the blank character closest to the value. +If wrapmargin is 0, +or if there is no blank character upon which to break the line, +the line will not be broken. +#endif +.It Li "wrapscan, ws [on]" +#ifdef MANUAL +Set searches to wrap around the end or beginning of the file. +#endif +#ifdef REFERENCE +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. +#endif +.It Li "writeany, wa [off]" +#ifdef MANUAL +Turn off file-overwriting checks. +#endif +#ifdef REFERENCE +If this option is set, file-overwriting checks that would usually be +made before the +.Sy write +and +.Sy xit +commands, or before an automatic write (see the +.Sy autowrite +option), are not made. +This allows a write to any file, provided the file permissions allow it. +#endif +.El diff --git a/usr.bin/vi/docs/spell.ok b/usr.bin/vi/docs/spell.ok index 9be8316b53c1..fce3673fac73 100644 --- a/usr.bin/vi/docs/spell.ok +++ b/usr.bin/vi/docs/spell.ok @@ -1,67 +1,163 @@ Amir +Autoprint +BRE's Bostic +Ds +ERE's +EXINIT Englar +Ev Fa Fl +HUnhsh +IPLPPPQPP Kirkendall +LIpplpipbp +LaA +Li Makefiles +NEXINIT +NHSHH Nex Nvi OS POSIX +PostScript RE's README SIGHUP +SIGWINCH +Se Std1003.2 +Sy TANDARDS +TIOCGWINSZ +TMPDIR +Todo USD.doc UUNET Vx +XXCOLUMNS XXXX ags +ai +altwerase +autoindent +autoprint autowrite aw +bf bostic bugs.current +carat +changelog cmd creens cs.berkeley.edu +db dbopen +def di +dir docs eFlRsv eFlRv +eb +edcompatible elvis email +enum +errorbells +esc +exrc exu fi ftp.cs.berkeley.edu ftp.uu.net +gdb +gdb.script +gzip'd hangup +hardtabs +ht +ic +ifdef +ignorecase ious +keystroke keystrokes +keytime leftright +li +libc.tags +lowercase +matchtime +meta +modeful +modeline +modelines nex +nexrc +nomagic nvi nvi.tar.Z +nvi.tar.z +para +pathname rc.local +readonly recdir recover.XXXX recover.c ript +ro +roff sc +scr screeen +set.opt.roff +shiftwidth +showmatch +showmode +sidescroll +slowopen +sm +sourceany sp +spell.ok svi +sw +tabstop +taglength tagpop tagtop +th +tl tmp +ts +ttytype +ttywerase ucb uffers +uppercase uunet var +vglobal +vi.0.ps +vi.0.txt +vi.1 vi.XXXX +vi.exrc vi.recover virecovery viu +wa +wi +wm +wrapmargin +wrapscan +writeany +ws xaw +xit +yy diff --git a/usr.bin/vi/docs/vi.0.ps b/usr.bin/vi/docs/vi.0.ps index 199c08f92333..cd33cc2056c6 100644 --- a/usr.bin/vi/docs/vi.0.ps +++ b/usr.bin/vi/docs/vi.0.ps @@ -1,13 +1,13 @@ %!PS-Adobe-3.0 %%Creator: groff version 1.08 -%%DocumentNeededResources: font Times-Bold +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold %%+ font Courier-Bold -%%+ font Times-Roman %%+ font Courier-Oblique %%+ font Courier -%%+ font Symbol +%%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.08 0 -%%Pages: 3 +%%Pages: 7 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments @@ -165,12 +165,12 @@ pop setpacking }if %%EndResource +%%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Courier-Bold -%%IncludeResource: font Times-Roman %%IncludeResource: font Courier-Oblique %%IncludeResource: font Courier -%%IncludeResource: font Symbol +%%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron /Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef @@ -196,256 +196,473 @@ grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute /ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve /oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex -/udieresis/yacute/thorn/ydieresis]def/Courier@0 ENC0/Courier RE -/Courier-Oblique@0 ENC0/Courier-Oblique RE/Times-Roman@0 ENC0/Times-Roman RE +/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE +/Courier@0 ENC0/Courier RE/Courier-Oblique@0 ENC0/Courier-Oblique RE /Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Bold@0 SF(Name)72 24 Q/F1 10/Courier-Bold@0 SF(ex, vi, view)102 36 -Q/F2 10/Times-Roman@0 SF 2.52.5 G -.15(ex)187.42 36 S 2.5(te).15 G -(ditors)206.43 36 Q F0(SYNOPSIS)72 60 Q F1(vi)102 72 Q F2([)3.333 E F1 -(\255eFlRv)2.499 E F2 3.333(][).833 G F1-.834 E/F3 10/Courier-Oblique@0 -SF(command)6 E F2 3.333(][).833 G F1-.834 E F3(file)6 E F2 3.333(][).833 -G F1-.834 E F3(tag)6 E F2 3.333(][).833 G F1-.834 E F3(size)6 E F2 -3.333(][).833 G F1-.834 E F3(aw)6 E F2(]).833 E F1(view)102 84 Q F2([) -3.333 E F1(\255eFlRv)2.499 E F2 3.333(][).833 G F1-.834 E F3(command)6 E -F2 3.333(][).833 G F1-.834 E F3(file)6 E F2 3.333(][).833 G F1-.834 -E F3(tag)6 E F2 3.333(][).833 G F1-.834 E F3(size)6 E F2 3.333(][).833 G -F1-.834 E F3(aw)6 E F2(]).833 E F1(ex)102 96 Q F2([)3.333 E F1 -(\255eFlRsv)2.499 E F2 3.333(][).833 G F1-.834 E F3(command)6 E F2 3.333 -(][).833 G F1-.834 E F3(file)6 E F2 3.333(][).833 G F1-.834 E F3 -(tag)6 E F2 3.333(][).833 G F1-.834 E F3(size)6 E F2 3.333(][).833 G F1 --.834 E F3(aw)6 E F2(]).833 E F0(DESCRIPTION)72 120 Q F1(Ex)102 132 Q F2 -.298(is a line-oriented te)2.798 F .298(xt editor)-.15 F(.)-.55 E F1(Vi)5.298 E -F2 .298(is a screen oriented te)2.798 F .298(xt editor)-.15 F 2.798(,b)-.4 G -.297(ased on)381.914 132 R F1(ex)2.797 E F2(.)A F1(View)2.797 E F2 .297 -(is the same as using)2.797 F(the)102 144 Q F14.243 E F2 .077 -(\(read-only\) option of)2.577 F F1(vi)2.577 E F2(.)A F1(Ex)2.577 E F2(and) -2.578 E F1(vi)2.578 E F2 .078(are really dif)2.578 F .078(ferent interf)-.25 F -.078(aces to the same program, and it is pos-)-.1 F -(sible to switch back and forth during the same edit session.)102 156 Q .686 -(This manual page is the one pro)102 174 R .686(vided with the)-.15 F F1(nex) -3.186 E F2(and)3.186 E F1(nvi)3.185 E F2 -.15(ve)3.185 G .685 -(rsions of the vi te).15 F .685(xt editors.)-.15 F F1(Nex)5.685 E F2(and)3.185 -E F1(nvi)3.185 E F2 .55(are intended as b)102 186 R(ug-for)-.2 E(-b)-.2 E .55 -(ug compatible replacements for the original F)-.2 F .55(ourth Berk)-.15 F(ele) --.1 E 3.05(yS)-.15 G(oftw)458.37 186 Q .55(are Distrib)-.1 F(ution)-.2 E -(\(4BSD\))102 198 Q F1(ex)2.5 E F2(and)2.5 E F1(vi)2.5 E F2(programs.)2.5 E -(The follo)102 216 Q(wing options are a)-.25 E -.25(va)-.2 G(ilable:).25 E F1 -103.666 234 Q F2(Ex)143 234 Q(ecute)-.15 E F3(command)2.834 E F2 .334 -(immediately after starting the edit session.)2.834 F .334 -(Useful for initial positioning in the)5.334 F .075(\214le, b)143 246 R(ut)-.2 -E F3(command)2.575 E F2 .075(is not limited to positioning commands.)2.575 F -.076(This is the POSIX 1003.2 interf)5.075 F .076(ace for)-.1 F(the historic `) -143 258 Q(`+command')-.74 E 2.5('s)-.74 G(yntax.)253.53 258 Q F1(Nex/nvi)5 E F2 -(supports both the old and ne)2.5 E 2.5(ws)-.25 G(yntax.)454.16 258 Q F1 -103.666 276 Q F2(Start editing in e)143 276 Q 2.5(xm)-.15 G -(ode, as if the command name w)224.52 276 Q(as)-.1 E F1(ex)2.5 E F2(.)A F1 -103.666 294 Q F2(Don')143 294 Q 2.946(tc)-.18 G(op)173.536 294 Q 2.946 -(yt)-.1 G .446(he entire \214le when \214rst starting to edit.)194.162 294 R -.446(\(The def)5.446 F .446(ault is to mak)-.1 F 2.946(ea)-.1 G(cop)-.001 E -2.945(yi)-.1 G 2.945(nc)487.46 294 S .445(ase some-)499.845 294 R -(one else tries to edit the \214le too.\))143 306 Q F1103.666 324 Q F2 -.867(List the \214les that may be reco)143 324 R -.15(ve)-.15 G .867 -(red using the).15 F F15.034 E F2 .868(option of)3.368 F F1(vi)3.368 E F2 -3.368(.T)C .868(his is the ne)414.062 324 R 3.368(wi)-.25 G(nterf)477.284 324 Q -.868(ace for the)-.1 F(historic)143 336 Q F14.166 E F2 -(without a \214le ar)2.5 E(gument syntax.)-.18 E F1(Nex/nvi)5 E F2 -(supports both the old and ne)2.5 E 2.5(ws)-.25 G(yntax.)491.556 336 Q F1 -103.666 354 Q F2(Start editing in read-only mode, as if the command name w)143 -354 Q(as)-.1 E F1(view)2.5 E F2(.)A F1103.666 372 Q F2(Reco)143 372 Q --.15(ve)-.15 G 2.5(rt).15 G(he speci\214ed \214le.)181.3 372 Q F1103.666 -390 Q F2 1.221(Enter batch mode; applicable only to)143 390 R F1(ex)3.721 E F2 -1.221(edit sessions.)3.721 F 1.22(Batch mode is useful when running)6.221 F F1 -(ex)3.72 E F2 3.307(scripts. Prompts,)143 402 R(informati)3.307 E 1.108 -.15 -(ve m)-.25 H .808(essages and other user oriented things are turned of).15 F -3.308(f. This)-.25 F .808(is the)3.308 F .189(POSIX 1003.2 interf)143 414 R -.189(ace for the historic)-.1 F F14.355 E F2(syntax.)2.689 E F1(Nex/nvi) -5.189 E F2 .189(supports both the old and ne)2.689 F 2.688(ws)-.25 G(yn-)526.67 -414 Q(tax.)143 426 Q F1103.666 444 Q F2 -(Start editing at the speci\214ed tag.)143 444 Q(\(See)5 E/F4 10/Courier@0 SF -(ctags)2.5 E F2(\(1\)\).)A F1103.666 462 Q F2(Set the initial windo)143 -462 Q 2.5(ws)-.25 G(ize to the speci\214ed number of lines.)237.2 462 Q F1 -103.666 480 Q F2(Start editing in vi mode, as if the command name w)143 -480 Q(as)-.1 E F1(vi)2.5 E F2(or)2.5 E F1(view)2.5 E F2(.)A F1103.666 498 -Q F2(Reserv)143 498 Q(ed for X11 interf)-.15 E 2.5(aces. Not)-.1 F -(currently implemented.)2.5 E F0(ADDITION)72 522 Q 1.666(AL FEA)-.2 F(TURES) --.95 E F2 .031(This manual page is the one distrib)102 534 R .032 -(uted with the)-.2 F F1(nvi)2.532 E F2(and)2.532 E F1(nex)2.532 E F2 .032 -(reimplementations of)2.532 F F1(ex/vi)2.532 E F2 2.532(.T)C .032 -(here are a fe)483.804 534 R(w)-.25 E(additional features in)102 546 Q F1 -(nex/nvi)2.5 E F2(.)A(8-bit clean data, lar)102 564 Q(ge lines, \214les)-.18 E -F1(Nvi/nex)143 576 Q F2 .864(will edit an)3.364 F 3.364(yf)-.15 G .864 -(ormat \214le.)246.636 576 R .863(Line lengths are limited by a)5.863 F -.25 -(va)-.2 G .863(ilable memory).25 F 3.363(,a)-.65 G .863(nd \214le sizes)491.054 -576 R .511(are limited by a)143 588 R -.25(va)-.2 G .511(ilable disk space.).25 -F .512(The command `)5.511 F(`^Vx[0-9A-F)-.74 E(a-f])-.15 E/F5 10/Symbol SF(*)A -F2 -.74('')C 3.012(,i).74 G 3.012(ni)439.892 588 S .512(nput mode, will insert) -450.684 588 R(an)143 600 Q 2.5(yl)-.15 G -2.25 -.15(eg a)162.57 600 T 2.5(lc) -.15 G(haracter v)185.97 600 Q(alue into the te)-.25 E(xt.)-.15 E(Split screens) -102 618 Q .036(The command `)143 630 R .036(`:sp[lit] [\214le ...]')-.74 F -2.536('s)-.74 G .036(plits the screen in vi mode.)280.01 630 R .035(The k)5.035 -F .335 -.15(ey `)-.1 H(`^W')-.59 E 2.535('s)-.74 G .035(witches between the) -458.84 630 R(fore)143 642 Q .09(ground screens, and the `)-.15 F .09 -(`:resize count')-.74 F 2.591('c)-.74 G .091(ommand can be used to gro)326.011 -642 R 2.591(wo)-.25 G 2.591(rs)451.287 642 S .091(hrink an)461.098 642 R 2.591 -(yp)-.15 G(articular)506.68 642 Q(screen.)143 654 Q(Background and fore)102 672 -Q(ground screens)-.15 E .921(The command `)143 684 R(`:bg')-.74 E 3.421('b)-.74 -G .921(ackgrounds the current screen, and the command `)237.873 684 R .92 -(`:fg [\214le]')-.74 F 3.42('f)-.74 G(ore)495.16 684 Q(grounds)-.15 E 1.79 -(the backgrounded screeen that is editing the speci\214ed \214le, or)143 696 R -4.29(,b)-.4 G 4.29(yd)412.68 696 S(ef)426.97 696 Q 1.79 -(ault, the \214rst background)-.1 F(screen on the queue.)143 708 Q -(The command `)5 E(`:di[splay] s[creens]')-.74 E 2.5('l)-.74 G -(ists the background screens.)383.67 708 Q(Shell screens)102 726 Q .128 -(The command `)143 738 R .128(`:sc[ript] [\214le ...]')-.74 F 2.628('r)-.74 G -.128(uns a shell in the screen.)284.9 738 R .127 -(Editing is unchanged, with the e)5.127 F(xcep-)-.15 E -(tion that a enters the current line \(stripped of an)143 750 -Q 2.5(yp)-.15 G(rompt\) as input to the shell.)418.78 750 Q -.8(Ta)102 768 S -2.5(gs).8 G(tacks)123.14 768 Q -.8(Ta)143 780 S .234(gs are no).8 F 2.734(wm) --.25 G .234(aintained in a stack.)206.802 780 R .234(The command `)5.234 F -(`^T')-.74 E 2.734('r)-.74 G .235(eturns to the pre)379.97 780 R .235 -(vious tag location.)-.25 F(The)5.235 E .251(command `)143 792 R .251 -(`:tagpop [number)-.74 F(\214le]')7.168 E 2.751('r)-.74 G .251 -(eturns to the most recent tag location by def)293.021 792 R .251(ault, or)-.1 -F 2.75(,o)-.4 G(ptional-)508.89 792 Q EP +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R/F1 10/Times-Bold@0 SF -.2(NA)72 +108 S(ME).2 E/F2 10/Courier-Bold@0 SF(ex, vi, view)102 120 Q F0 2.52.5 G +-.15(ex)187.42 120 S 2.5(te).15 G(ditors)206.43 120 Q F1(SYNOPSIS)72 144 Q F2 +(ex)102 156 Q F0([)3.333 E F2(\255eFlRsv)2.499 E F0 3.333(][).833 G F2 +-.834 E/F3 10/Courier-Oblique@0 SF(cmd)6 E F0 3.333(][).833 G F2-.834 E +F3(file)6 E F0 3.333(][).833 G F2-.834 E F3(tag)6 E F0 3.333(][).833 G F2 +-.834 E F3(size)6 E F0 3.333(][).833 G F2-.834 E F3(aw)6 E F0 3.333 +(][).833 G F3(file ...)429.446 156 Q F0(]).833 E F2(vi)102 168 Q F0([)3.333 E +F2(\255eFlRv)2.499 E F0 3.333(][).833 G F2-.834 E F3(cmd)6 E F0 3.333(][) +.833 G F2-.834 E F3(file)6 E F0 3.333(][).833 G F2-.834 E F3(tag)6 +E F0 3.333(][).833 G F2-.834 E F3(size)6 E F0 3.333(][).833 G F2 +-.834 E F3(aw)6 E F0 3.333(][).833 G F3(file ...)423.446 168 Q F0(]).833 E F2 +(view)102 180 Q F0([)3.333 E F2(\255eFlRv)2.499 E F0 3.333(][).833 G F2 +-.834 E F3(cmd)6 E F0 3.333(][).833 G F2-.834 E F3(file)6 E F0 3.333(][) +.833 G F2-.834 E F3(tag)6 E F0 3.333(][).833 G F2-.834 E F3(size)6 +E F0 3.333(][).833 G F2-.834 E F3(aw)6 E F0 3.333(][).833 G F3(file ...) +435.446 180 Q F0(]).833 E F1(DESCRIPTION)72 204 Q F2(Vi)102 216 Q F0 .176 +(is a screen oriented te)2.676 F .176(xt editor)-.15 F(.)-.55 E F2(Ex)5.176 E +F0 .176(is a line-oriented te)2.676 F .175(xt editor)-.15 F(.)-.55 E F2(Ex) +5.175 E F0(and)2.675 E F2(vi)2.675 E F0 .175(are dif)2.675 F .175 +(ferent interf)-.25 F .175(aces to the)-.1 F .56(same program, and it is possi\ +ble to switch back and forth during an edit session.)102 228 R F2(View)5.561 E +F0 .561(is the equi)3.061 F -.25(va)-.25 G .561(lent of).25 F(using the)102 240 +Q F24.166 E F0(\(read-only\) option of)2.5 E F2(vi)2.5 E F0(.)A .216 +(This manual page is the one pro)102 258 R .215(vided with the)-.15 F F2 +(nex/nvi)2.715 E F0 -.15(ve)2.715 G .215(rsions of the).15 F F2(ex/vi)2.715 E +F0(te)2.715 E .215(xt editors.)-.15 F F2(Nex/nvi)5.215 E F0(are)2.715 E 1.937 +(intended as b)102 270 R(ug-for)-.2 E(-b)-.2 E 1.937 +(ug compatible replacements for the original F)-.2 F 1.938(ourth Berk)-.15 F +(ele)-.1 E 4.438(yS)-.15 G(oftw)456.982 270 Q 1.938(are Distrib)-.1 F(ution)-.2 +E(\(4BSD\))102 282 Q F2(ex)3.008 E F0(and)3.008 E F2(vi)3.008 E F0 3.008 +(programs. F)3.008 F .508(or the rest of this manual page,)-.15 F F2(nex/nvi) +3.008 E F0 .507(is used only when it')3.008 F 3.007(sn)-.55 G(ecessary)506.13 +282 Q(to distinguish it from the historic implementations of)102 294 Q F2 +(ex/vi)2.5 E F0(.)A .961(This manual page is intended for users already f)102 +312 R .961(amiliar with)-.1 F F2(ex/vi)3.461 E F0 3.462(.A)C -.15(ny)397.982 +312 S .962(one else should almost certainly).15 F .582 +(read a good tutorial on the editor before this manual page.)102 324 R .582 +(If you')5.582 F .581(re in an unf)-.5 F .581(amiliar en)-.1 F .581 +(vironment, and you)-.4 F 1.111(absolutely ha)102 336 R 1.411 -.15(ve t)-.2 H +3.611(og).15 G 1.111(et w)185.253 336 R 1.111(ork done immediately)-.1 F 3.611 +(,r)-.65 G 1.111(ead the section near the end of this manual page, entitled) +301.987 336 R -.74(FA)102 348 S(ST ST).74 E(AR)-.93 E(TUP)-.6 E 5(.I)-1.11 G +(t')180.85 348 Q 2.5(sp)-.55 G(robably enough to get you going.)197.8 348 Q +(The follo)102 366 Q(wing options are a)-.25 E -.25(va)-.2 G(ilable:).25 E F2 +103.666 384 Q F0(Ex)137 384 Q(ecute)-.15 E F3(cmd)2.675 E F0 .175 +(immediately after starting the edit session.)2.675 F -.15(Pa)5.175 G .174 +(rticularly useful for initial positioning in).15 F .624(the \214le, ho)137 396 +R(we)-.25 E -.15(ve)-.25 G(r).15 E F3(cmd)3.124 E F0 .625 +(is not limited to positioning commands.)3.124 F .625 +(This is the POSIX 1003.2 interf)5.625 F(ace)-.1 E(for the historic `)137 408 Q +(`+cmd')-.74 E 2.5('s)-.74 G(yntax.)239.47 408 Q F2(Nex/nvi)5 E F0 +(supports both the old and ne)2.5 E 2.5(ws)-.25 G(yntax.)440.1 408 Q F2 +103.666 426 Q F0(Start editing in e)137 426 Q 2.5(xm)-.15 G +(ode, as if the command name were)218.52 426 Q F2(ex)2.5 E F0(.)A F2 +103.666 444 Q F0(Don')137 444 Q 2.677(tc)-.18 G(op)167.267 444 Q 2.677(yt)-.1 G +.177(he entire \214le when \214rst starting to edit.)187.624 444 R .177 +(\(The def)5.177 F .177(ault is to mak)-.1 F 2.677(eac)-.1 G(op)456.532 444 Q +2.676(yi)-.1 G 2.676(nc)476.888 444 S .176(ase someone)489.004 444 R +(else modi\214es the \214le during your edit session.\))137 456 Q F2 +103.666 474 Q F0 .249(List the \214les that may be reco)137 474 R -.15(ve)-.15 +G .249(red using the).15 F F24.415 E F0 .249(option of)2.749 F F2(vi) +2.749 E F0 2.749(.T)C .249(his is the ne)400.023 474 R 2.75(wi)-.25 G(nterf) +460.77 474 Q .25(ace for the his-)-.1 F 1.181(toric syntax of the)137 486 R F2 +5.347 E F0 1.181(option without a \214le ar)3.681 F(gument.)-.18 E F2 +(Nex/nvi)6.181 E F0 1.181(supports both the old and ne)3.681 F(w)-.25 E +(syntax.)137 498 Q F2103.666 516 Q F0 .184 +(Start editing in read-only mode, as if the command name w)137 516 R(as)-.1 E +F2(view)2.685 E F0 2.685(,o)C 2.685(rt)421.415 516 S .185(he readonly option w) +430.21 516 R .185(as set.)-.1 F F2103.666 534 Q F0(Reco)137 534 Q -.15 +(ve)-.15 G 2.5(rt).15 G(he speci\214ed \214le.)175.3 534 Q F2103.666 552 +Q F0 1.621(Enter batch mode; applicable only to)137 552 R F2(ex)4.121 E F0 +1.621(edit sessions.)4.121 F 1.62(Batch mode is useful when running)6.621 F F2 +(ex)4.12 E F0 2.647(scripts. Prompts,)137 564 R(informati)2.647 E .447 -.15 +(ve m)-.25 H .147(essages and other user oriented message are turned of).15 F +.148(f, and no start-)-.25 F .067(up \214les or en)137 576 R .067 +(vironmental v)-.4 F .066(ariables are read.)-.25 F .066 +(This is the POSIX 1003.2 interf)5.066 F .066(ace for the historic `)-.1 F +(`\255')-.74 E(')-.74 E(ar)137 588 Q(gument.)-.18 E F2(Nex/nvi)5 E F0 +(supports both the old and ne)2.5 E 2.5(ws)-.25 G(yntax.)353 588 Q F2 +103.666 606 Q F0(Start editing at the speci\214ed tag.)137 606 Q(\(See)5 E/F4 +10/Courier@0 SF(ctags)2.5 E F0(\(1\)\).)A F2103.666 624 Q F0 +(Set the initial windo)137 624 Q 2.5(ws)-.25 G +(ize to the speci\214ed number of lines.)231.2 624 Q F2103.666 642 Q F0 +(Start editing in vi mode, as if the command name w)137 642 Q(as)-.1 E F2(vi) +2.5 E F0(or)2.5 E F2(view)2.5 E F0(.)A F2103.666 660 Q F0(Reserv)137 660 +Q(ed for X11 interf)-.15 E(aces.)-.1 E/F5 10/Times-Italic@0 SF +(No X11 support is curr)5 E(ently implemented.)-.37 E F2(Ex/vi)102 678 Q F0 +-.15(ex)2.5 G(it 0 on success, and greater than 0 if an error occurs.).15 E +167.75(4.4BSD March)72 750 R(19, 1994)2.5 E(1)535 750 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF .45(ly to a speci\214c tag number in the tag stack, or\ - the most recent tag from the speci\214ed \214le.)143 12 R .45(Use the)5.45 F -.186(command `)143 24 R .186(`:di[splay] t[ags]')-.74 F 2.686('t)-.74 G 2.686 -(ov)266.218 24 S(ie)278.904 24 Q 2.686(wt)-.25 G .185(he tags stack.)298.56 24 -R .185(The command `)5.185 F(`:tagtop')-.74 E 2.685('r)-.74 G .185 -(eturns to the top of)463.71 24 R(the tag stack.)143 36 Q(Ne)102 54 Q 2.5(wd) --.25 G(isplays)128.13 54 Q 1.268(The command `)143 66 R 1.268(`:di[splay] b[uf) --.74 F 6.702(fers] s[creens] t[ags]')-.25 F 3.768('c)-.74 G 1.269 -(an be used to display)379.666 66 R 3.769(,r)-.65 G(especti)477.571 66 Q -.15 -(ve)-.25 G(ly).15 E 3.769(,t)-.65 G(he)530.56 66 Q(current cut b)143 78 Q(uf) --.2 E(fers, the backgrounded screens, and the tags stack.)-.25 E -(In\214nite undo)102 96 Q 1.052 -(The changes made during an edit session may be rolled backw)143 108 R 1.051 -(ard and forw)-.1 F 3.551(ard. A)-.1 F('.)3.551 E 3.551('c)-.7 G(ommand)505 108 -Q .369(immediately after a 'u' command continues either forw)143 120 R .369 -(ard or backw)-.1 F .37(ard depending on whether the)-.1 F('u' command w)143 -132 Q(as an undo or a redo.)-.1 E(Usage information)102 150 Q .668 -(The command `)143 162 R(`:e)-.74 E .668(xu[sage [cmd]')-.15 F 3.168('a)-.74 G -.668(nd `)288.992 162 R .668(`viu[sage] [k)-.74 F -.15(ey)-.1 G(]').15 E 3.168 -('p)-.74 G(ro)383.396 162 Q .667(vide usage information for all of the)-.15 F -.3 -.15(ex a)143 174 T(nd vi commands by def).15 E(ault, or)-.1 E 2.5(,o)-.4 G -(ptionally)290.94 174 Q 2.5(,f)-.65 G(or a speci\214c command or k)334.18 174 Q --.15(ey)-.1 G(.)-.5 E(Extended re)102 192 Q(gular e)-.15 E(xpressions)-.15 E -.811(The `)143 204 R .811(`:set e)-.74 F(xtended')-.15 E 3.311('c)-.74 G .812 -(ommand treats search and other command re)234.603 204 R .812(gular e)-.15 F -.812(xpressions as e)-.15 F(xtended)-.15 E(\(e)143 216 Q(grep\(1\) style\) re) --.15 E(gular e)-.15 E(xpressions.)-.15 E -.8(Wo)102 234 S(rd search).8 E -(The command `)143 246 Q(`^A')-.74 E 2.5('s)-.74 G(earches for the w)231.77 246 -Q(ord referenced by the cursor)-.1 E(.)-.55 E(Number increment)102 264 Q -(The command `)143 276 Q(`#')-.74 E 2.5('i)-.74 G -(ncrements the number referenced by the cursor)225.11 276 Q(.)-.55 E(Pre)102 -294 Q(vious \214le)-.25 E(The command `)143 306 Q(`:pre)-.74 E(v[ious][!]')-.25 -E 2.5('e)-.74 G(dits the pre)275.39 306 Q(vious \214le from the ar)-.25 E -(gument list.)-.18 E(Left-Right scrolling)102 324 Q .734(The command `)143 336 -R .733(`:set leftright')-.74 F 3.233('m)-.74 G(ak)276.653 336 Q(es)-.1 E/F1 10 -/Courier-Bold@0 SF(nvi)3.233 E F0 .733 -(do left-right screen scrolling, instead of the traditional)3.233 F F1(vi)143 -348 Q F0(line wrapping.)2.5 E/F2 10/Times-Bold@0 SF(RECO)72 372 Q(VER)-.5 E(Y) --.35 E F0 1.079(There is no reco)102 384 R -.15(ve)-.15 G 1.079 -(ry program for n).15 F 1.079(vi, nor does it run setuid.)-.4 F 1.079 -(Users may reco)6.079 F -.15(ve)-.15 G 3.579(ra).15 G 1.379 -.15(ny \214) -444.324 384 T 1.079(le which the).15 F 3.579(ym)-.15 G(ay)530.56 384 Q -(read, and the superuser may reco)102 396 Q -.15(ve)-.15 G 2.5(ra).15 G .3 -.15 -(ny e)253.03 396 T(dit session.).15 E 2.995(Edit sessions are back)102 414 R -2.994(ed by \214les in)-.1 F/F3 10/Courier@0 SF(/var/tmp/vi.recover)5.494 E F0 -5.494(,a)C 2.994(nd are named `)391.224 414 R(`vi.XXXX')-.74 E 2.994(', where) --.74 F -.74(``)102 426 S(XXXX').74 E 3.104('i)-.74 G 3.104(san)148.604 426 S -.605(umber related to the process id.)168.142 426 R .605 -(When a \214le is \214rst modi\214ed, a second \214le, which contains)5.605 F -.185(an email message for the user)102 438 R 2.685(,i)-.4 G 2.685(sc)229.07 438 -S .185(reated, and is named `)240.085 438 R(`reco)-.74 E -.15(ve)-.15 G -.55 -(r.).15 G(XXXX').55 E .185(', where, ag)-.74 F .185(ain, `)-.05 F(`XXXX')-.74 E -2.685('i)-.74 G 2.685(sa)505.655 438 S(ssoci-)516.67 438 Q .098 -(ated with the process id.)102 450 R .098(Both \214les are remo)5.098 F -.15 -(ve)-.15 G 2.599(da).15 G 2.599(tt)302.273 450 S .099 -(he end of a normal edit session, b)310.432 450 R .099 -(ut will remain if the ed-)-.2 F 2.248 -(it session is abnormally terminated or the user enters the e)102 462 R 2.248 -(x/vi `)-.15 F(`preserv)-.74 E(e')-.15 E 4.748('c)-.74 G 4.748(ommand. The) -431.578 462 R 2.248(use of the)4.748 F F3(/var/tmp)102 474 Q F0 .028 -(directory may be changed setting the option `)2.528 F(`recdir')-.74 E 2.529 -('i)-.74 G 2.529(nt)371.226 474 S .029(he user')381.535 474 R 2.529(so)-.55 G -2.529(rs)424.363 474 S .029(ystem startup information.)434.112 474 R .144 -(The reco)102 492 R -.15(ve)-.15 G .144(ry directory should ha).15 F .444 -.15 -(ve t)-.2 H .144(he `).15 F(`stick)-.74 E(y-bit')-.15 E 2.643('s)-.74 G .143 -(et so that only the o)317.617 492 R .143(wners of \214les may remo)-.25 F .443 --.15(ve t)-.15 H 2.643(hem. If).15 F .106 -(this is not possible on the system, then a pseudo-user should o)102 504 R .106 -(wn the reco)-.25 F -.15(ve)-.15 G .106(ry directory).15 F 5.106(.T)-.65 G .106 -(he reco)467.348 504 R -.15(ve)-.15 G .106(ry direc-).15 F -(tory must be both read and write-able by an)102 516 Q 2.5(yu)-.15 G(ser)288.76 -516 Q(.)-.55 E .601(The reco)102 534 R -.15(ve)-.15 G .601(ry \214le has all o\ -f the necessary information in it to enable the user to reco).15 F -.15(ve)-.15 -G 3.101(rt).15 G .601(he edit session.)464.037 534 R(In)5.601 E .322 -(addition, it has all of the necessary email headers for sendmail.)102 546 R -.322(When the system is rebooted, all of the \214les)5.322 F(in)102 558 Q F3 -(/var/tmp/vi.recover)2.695 E F0 .195(named `)2.695 F(`reco)-.74 E -.15(ve)-.15 -G -.55(r.).15 G(XXXX').55 E 2.695('s)-.74 G .195 -(hould be sent by email, using the)337.46 558 R F14.36 E F0 .194 -(\215ag of send-)2.694 F .335 -(mail \(or a similar mechanism in other mailers\).)102 570 R 2.835(As)5.335 G -.335(imple w)311.935 570 R .335(ay to do this is to insert the follo)-.1 F .335 -(wing script into)-.25 F(your rc.local \(or other startup\) \214le:)102 582 Q -F3 6(#R)132 618 S(ecover nvi editor files.)150 618 Q -(virecovery=/var/tmp/vi.recover/recover.)132 630 Q/F4 10/Symbol SF(*)A F3 -(if [ "$virecovery" != "/var/tmp/vi.recover/recover.)132 642 Q F4(*)A F3 6("])C -6(;t)461 642 S(hen)479 642 Q(echo 'Recovering vi editor sessions')177 654 Q -(for i in $virecovery; do)177 666 Q(sendmail -t < $i)222 678 Q(done)177 690 Q -(fi)132 702 Q F0(If)102 720 Q F1(nex/nvi)2.5 E F0(recei)2.5 E -.15(ve)-.25 G -2.5(sah).15 G(angup \(SIGHUP\) signal, it will email the reco)202.46 720 Q -.15 -(ve)-.15 G(ry information to the user itself.).15 E .774(If you don')102 738 R -3.274(th)-.18 G -2.25 -.2(av e)159.412 738 T .774 -(the sendmail program on your system, the source \214le)3.474 F F3 -(nvi/recover.c)3.273 E F0 .773(will ha)3.273 F 1.073 -.15(ve t)-.2 H 3.273(ob) -.15 G(e)535.56 738 Q(modi\214ed to use your mail deli)102 750 Q -.15(ve)-.25 G -(ry programs.).15 E EP +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R/F1 10/Times-Bold@0 SF(ENVIR)72 96 +Q(ONMENT)-.3 E 1.666(AL V)-.9 F(ARIABLES)-1.35 E/F2 10/Courier@0 SF(COLUMNS)102 +108 Q F0 .036(The number of columns on the screen.)131 120 R .036(This v)5.036 +F .036(alue o)-.25 F -.15(ve)-.15 G .036(rrides an).15 F 2.536(ys)-.15 G .037 +(ystem or terminal speci\214c v)394.256 120 R 2.537(alues. If)-.25 F .211 +(the COLUMNS en)131 132 R .211(vironmental v)-.4 F .211 +(ariable is not set when)-.25 F/F3 10/Courier-Bold@0 SF(ex/vi)2.711 E F0 .211 +(runs, or the)2.711 F F1(columns)2.71 E F0 .21(option is e)2.71 F(xplic-)-.15 E +(itly reset by the user)131 144 Q(,)-.4 E F3(ex/vi)2.5 E F0(enters the v)2.5 E +(alue into the en)-.25 E(vironment.)-.4 E F2(EXINIT)102 156 Q F0 2.5(Al)131 168 +S(ist of)143.5 168 Q F3(ex)2.5 E F0(startup commands, read if the v)2.5 E +(ariable)-.25 E F2(NEXINIT)2.5 E F0(is not set.)2.5 E F2(HOME)102 180 Q F0 +1.562(The user')5 F 4.062(sh)-.55 G 1.562(ome directory)183.004 180 R 4.062(,u) +-.65 G 1.562(sed as the initial directory path for the startup)251.298 180 R F2 +($HOME/.nexrc)4.063 E F0(and)4.063 E F2($HOME/.exrc)131 192 Q F0 2.5 +(\214les. This)2.5 F -.25(va)2.5 G(lue is also used as the def).25 E +(ault directory for the)-.1 E F3(vi)2.5 E F1(cd)2.5 E F0(command.)2.5 E F2 +(LINES)102 204 Q F0 .033(The number of ro)131 216 R .033(ws on the screen.)-.25 +F .033(This v)5.033 F .033(alue o)-.25 F -.15(ve)-.15 G .033(rrides an).15 F +2.533(ys)-.15 G .033(ystem or terminal speci\214c v)379.523 216 R 2.533 +(alues. If)-.25 F(the)2.532 E .666(LINES en)131 228 R .666(vironmental v)-.4 F +.666(ariable is not set when)-.25 F F3(ex/vi)3.166 E F0 .666(runs, or the)3.166 +F F1(lines)3.166 E F0 .667(option is e)3.166 F .667(xplicitly reset by)-.15 F +(the user)131 240 Q(,)-.4 E F3(ex/vi)2.5 E F0(enters the v)2.5 E +(alue into the en)-.25 E(vironment.)-.4 E F2(NEXINIT)102 252 Q F0 2.5(Al)131 +264 S(ist of)143.5 264 Q F3(ex)2.5 E F0(startup commands.)2.5 E F2(SHELL)102 +276 Q F0(The user')131 288 Q 2.5(ss)-.55 G(hell of choice \(see also the)178.77 +288 Q F1(shell)2.5 E F0(option\).)2.5 E F2(TERM)102 300 Q F0 .252(The user')5 F +2.752(st)-.55 G .252(erminal type.)178.164 300 R .252(The def)5.252 F .251 +(ault is the type `)-.1 F(`unkno)-.74 E(wn')-.25 E .251('. If the TERM en)-.74 +F .251(vironmental v)-.4 F .251(ariable is)-.25 F .578(not set when)131 312 R +F3(ex/vi)3.078 E F0 .578(runs, or the)3.078 F F1(term)3.078 E F0 .578 +(option is e)3.078 F .578(xplicitly reset by the user)-.15 F(,)-.4 E F3(ex/vi) +3.079 E F0 .579(enters the v)3.079 F(alue)-.25 E(into the en)131 324 Q +(vironment.)-.4 E F2(TMPDIR)102 336 Q F0 +(The location used to stored temporary \214les \(see also the)131 348 Q F1(dir) +2.5 E(ectory)-.18 E F0(option\).)2.5 E F1 1.666(SET OPTIONS)72 372 R F0 .519 +(There are a lar)102 384 R .518 +(ge number of options that may be set \(or unset\) to change the editor')-.18 F +3.018(sb)-.55 G(eha)453.614 384 Q(vior)-.2 E 5.518(.T)-.55 G .518(his section) +496.982 384 R(describes the options, their abbre)102 396 Q +(viations and their def)-.25 E(ault v)-.1 E(alues.)-.25 E .095 +(In each entry belo)102 414 R 1.395 -.65(w, t)-.25 H .095 +(he \214rst part of the tag line is the full name of the option, follo).65 F +.095(wed by an)-.25 F 2.595(ye)-.15 G(qui)487.915 414 Q -.25(va)-.25 G .095 +(lent ab-).25 F(bre)102 426 Q 3.034(viations. The)-.25 F .534 +(part in square brack)3.034 F .533(ets is the def)-.1 F .533(ault v)-.1 F .533 +(alue of the option.)-.25 F .533(Most of the options are boolean,)5.533 F +(i.e. the)102 438 Q 2.5(ya)-.15 G(re either on or of)140.73 438 Q +(f, and do not ha)-.25 E .3 -.15(ve a)-.2 H 2.5(na).15 G(ssociated v)298.14 438 +Q(alue.)-.25 E(Options apply to both)102 456 Q F3(ex)2.5 E F0(and)2.5 E F3(vi) +2.5 E F0(modes, unless otherwise speci\214ed.)2.5 E F2(altwerase [off])102 468 +Q F3(Vi)131 480 Q F0(only)2.5 E 5(.S)-.65 G(elect an alternate w)175.69 480 Q +(ord erase algorithm.)-.1 E F2(autoindent, ai [off])102 492 Q F0 +(Automatically indent ne)131 504 Q 2.5(wl)-.25 G(ines.)239.91 504 Q F2 +(autoprint, ap [off])102 516 Q F3(Ex)131 528 Q F0(only)2.5 E 5(.D)-.65 G +(isplay the current line automatically)177.35 528 Q(.)-.65 E F2 +(autowrite, aw [off])102 540 Q F0 +(Write modi\214ed \214les automatically when changing \214les.)131 552 Q F2 +(beautify, bf [off])102 564 Q F0(Discard control characters.)131 576 Q F2 +(cdpath [environment variable CDPATH, or ``.''])102 588 Q F0 +(The directory paths used as path pre\214x)131 600 Q(es for the)-.15 E F1(cd) +2.5 E F0(command.)2.5 E F2(columns, co [80])102 612 Q F0 +(Set the number of columns in the screen.)131 624 Q F2(comment [off])102 636 Q +F3(Vi)131 648 Q F0(only)2.5 E 5(.S)-.65 G(kip leading comments in \214les.) +175.69 648 Q F2(directory, dir [environment variable TMPDIR, or /tmp])102 660 Q +F0(The directory where temporary \214les are created.)131 672 Q F2 +(edcompatible, ed [off])102 684 Q F0(Modify the beha)131 696 Q +(vior of certain suf)-.2 E(\214ces for the)-.25 E F3(ex)2.5 E F1(substitute)2.5 +E F0(command.)2.5 E 167.75(4.4BSD March)72 750 R(19, 1994)2.5 E(2)535 750 Q EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Bold@0 SF -.1(BU)72 12 S(GS).1 E/F1 10/Times-Roman@0 SF -(This man page is w)102 24 Q(oefully incomplete.)-.1 E(Man)102 42 Q 2.5(ya)-.15 -G(nd v)132.12 42 Q 2.5(aried. See)-.25 F(the \214le)2.5 E/F2 10/Courier@0 SF -(nvi/docs/bugs.current)2.5 E F1(for a list of the kno)2.5 E(wn b)-.25 E -(ugs in this v)-.2 E(ersion.)-.15 E F0(FILES)72 66 Q F2(/tmp)102 78 Q F1 -(Storage for temporary \214les.)245 78 Q F2(/var/tmp/vi.recover)102 90 Q F1 -(Storage for reco)245 90 Q -.15(ve)-.15 G(ry \214les.).15 E F0 1.666(SEE ALSO) -72 114 R F2(ctags)102 126 Q F1(\(1\),)A F2(more)5 E F1(\(1\),)A F2(curses)5 E -F1(\(3\),)A F2(dbopen)5 E F1(\(3\))A(The `)102 150 Q(`V)-.74 E 2.5(iQ)-.6 G -(uick Reference')145.09 150 Q 2.5('c)-.74 G(ard.)218.2 150 Q -.74(``)102 174 S +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R/F1 10/Times-Italic@0 SF +(This option is not yet implemented.)131 96 Q/F2 10/Courier@0 SF +(errorbells, eb [off])102 108 Q/F3 10/Courier-Bold@0 SF(Ex)131 120 Q F0(only) +2.5 E 5(.P)-.65 G(recede error messages with a bell.)175.69 120 Q F1 +(This option is not yet implemented.)131 132 Q F2(exrc, ex [off])102 144 Q F0 +(Ne)131 156 Q -.15(ve)-.25 G 2.5(rr).15 G +(ead startup \214les in the local directory)160.86 156 Q(.)-.65 E F2 +(extended [off])102 168 Q F0(Re)131 180 Q(gular e)-.15 E(xpressions are e)-.15 +E(xtended \(i.e.)-.15 E F2(egrep)5 E F0(\(1\) style\) e)A(xpressions.)-.15 E F2 +(flash [on])102 192 Q F0(Flash the screen instead of beeping the k)131 204 Q +-.15(ey)-.1 G(board on error).15 E(.)-.55 E F2(hardtabs, ht [8])102 216 Q F0 +(Set the spacing between hardw)131 228 Q(are tab settings.)-.1 E F2 +(ignorecase, ic [off])102 240 Q F0(Ignore case dif)131 252 Q(ferences in re) +-.25 E(gular e)-.15 E(xpressions.)-.15 E F2(keytime [6])102 264 Q F0(The 10th') +131 276 Q 2.5(so)-.55 G 2.5(fas)181 276 S(econd)197.66 276 Q F3(ex/vi)2.5 E F0 +-.1(wa)2.5 G(its for a subsequent k).1 E .3 -.15(ey t)-.1 H 2.5(oc).15 G +(omplete a k)379.5 276 Q .3 -.15(ey m)-.1 H(apping.).15 E F2(leftright [off]) +102 288 Q F3(Vi)131 300 Q F0(only)2.5 E 5(.D)-.65 G 2.5(ol)177.35 300 S +(eft-right scrolling.)187.63 300 Q F2(lines, li [24])102 312 Q F3(Vi)131 324 Q +F0(only)2.5 E 5(.S)-.65 G(et the number of lines in the screen.)175.69 324 Q F2 +(lisp [off])102 336 Q F3(Vi)131 348 Q F0(only)2.5 E 5(.M)-.65 G(odify v)179.02 +348 Q(arious search commands and options to w)-.25 E(ork with Lisp.)-.1 E F1 +(This option is not yet implemented.)131 360 Q F2(list [off])102 372 Q F0 +(Display lines in an unambiguous f)131 384 Q(ashion.)-.1 E F2(magic [on])102 +396 Q F0 -.35(Tr)131 408 S(eat certain characters specially in re).35 E +(gular e)-.15 E(xpressions.)-.15 E F2(matchtime [7])102 420 Q F3(Vi)131 432 Q +F0(only)2.884 E 5.384(.T)-.65 G .384(he 10th')177.008 432 R 2.884(so)-.55 G +2.884(fas)221.666 432 S(econd)239.094 432 Q F3(ex/vi)2.884 E F0 .385 +(pauses on the matching character when the)2.884 F/F4 10/Times-Bold@0 SF(sho) +2.885 E(wmatch)-.1 E F0(op-)2.885 E(tion is set.)131 444 Q F2(mesg [on])102 456 +Q F0(Permit messages from other users.)131 468 Q F2(modelines, modeline [off]) +102 480 Q F0(Read the \214rst and last fe)131 492 Q 2.5(wl)-.25 G +(ines of each \214le for)240.18 492 Q F3(ex)2.5 E F0(commands.)2.5 E F1 +(This option will ne)131 504 Q(ver be implemented.)-.15 E F2(number, nu [off]) +102 516 Q F0(Precede each line displayed with its current line number)131 528 Q +(.)-.55 E F2(open [on])102 540 Q F3(Ex)131 552 Q F0(only)2.5 E 5(.I)-.65 G 2.5 +(ft)173.46 552 S(his option is not set, the)182.07 552 Q F4(open)2.5 E F0(and) +2.5 E F4(visual)2.5 E F0(commands are disallo)2.5 E(wed.)-.25 E F2 +(optimize, opt [on])102 564 Q F3(Vi)131 576 Q F0(only)2.5 E 5(.O)-.65 G +(ptimize te)177.35 576 Q(xt throughput to dumb terminals.)-.15 E F1 +(This option is not yet implemented.)131 588 Q F2 +(paragraphs, para [IPLPPPQPP LIpplpipbp])102 600 Q F3(Vi)131 612 Q F0(only)2.5 +E 5(.D)-.65 G(e\214ne additional paragraph boundaries for the)177.35 612 Q F4 +({)2.5 E F0(and)2.5 E F4(})2.5 E F0(commands.)2.5 E F2(prompt [on])102 624 Q F3 +(Ex)131 636 Q F0(only)2.5 E 5(.D)-.65 G(isplay a command prompt.)177.35 636 Q +F2(readonly, ro [off])102 648 Q F0(Mark the \214le as read-only)131 660 Q(.) +-.65 E F2(recdir [/var/tmp/vi.recover])102 672 Q F0 167.75(4.4BSD March)72 750 +R(19, 1994)2.5 E(3)535 750 Q EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R(The directory where reco)131 96 Q +-.15(ve)-.15 G(ry \214les are stored.).15 E/F1 10/Courier@0 SF +(redraw, re [off])102 108 Q/F2 10/Courier-Bold@0 SF(Vi)131 120 Q F0(only)2.5 E +5(.S)-.65 G(imulate an intelligent terminal on a dumb one.)175.69 120 Q/F3 10 +/Times-Italic@0 SF(This option is not yet implemented.)131 132 Q F1(remap [on]) +102 144 Q F0(Remap k)131 156 Q -.15(ey)-.1 G 2.5(su).15 G(ntil resolv)187.41 +156 Q(ed.)-.15 E F1(remapmax [on])102 168 Q F0(Limit the number of times a k) +131 180 Q .3 -.15(ey m)-.1 H(ay be remapped.).15 E F1(report [5])102 192 Q F0 +(Set the number of lines about which the editor reports changes.)131 204 Q F1 +(ruler [off])102 216 Q F2(Vi)131 228 Q F0(only)2.5 E 5(.D)-.65 G(isplay a ro) +177.35 228 Q(w/column ruler on the colon command line.)-.25 E F1 +(scroll, scr [window / 2])102 240 Q F0(Set the number of lines scrolled.)131 +252 Q F1(sections, sect [NHSHH HUnhsh])102 264 Q F2(Vi)131 276 Q F0(only)2.5 E +5(.D)-.65 G(e\214ne additional section boundaries for the)177.35 276 Q/F4 10 +/Times-Bold@0 SF([[)2.5 E F0(and)2.5 E F4(]])2.5 E F0(commands.)2.5 E F1 +(shell, sh [environment variable SHELL, or /bin/sh])102 288 Q F0 +(Select the shell used by the editor)131 300 Q(.)-.55 E F1(shiftwidth, sw [8]) +102 312 Q F0(Set the autoindent and shift command indentation width.)131 324 Q +F1(showdirty [off])102 336 Q F2(Vi)131 348 Q F0(only)2.5 E 5(.D)-.65 G(isplay \ +an asterisk on the colon command line if the \214le has been modi\214ed.)177.35 +348 Q F1(showmatch, sm [off])102 360 Q F2(Vi)131 372 Q F0(only)2.5 E 5(.N)-.65 +G(ote matching `)177.35 372 Q(`{')-.74 E 2.5('a)-.74 G(nd `)255.37 372 Q(`\(') +-.74 E 2.5('f)-.74 G(or `)288.87 372 Q(`}')-.74 E 2.5('a)-.74 G(nd `)323.28 372 +Q(`\)')-.74 E 2.5('c)-.74 G(haracters.)357.89 372 Q F1(showmode [off])102 384 Q +F2(Vi)131 396 Q F0(only)2.5 E 5(.D)-.65 G +(isplay the current editor mode \(command or input\).)177.35 396 Q F1 +(sidescroll [16])102 408 Q F2(Vi)131 420 Q F0(only)2.5 E 5(.S)-.65 G +(et the amount a left-right scroll will shift.)175.69 420 Q F1 +(slowopen, slow [off])102 432 Q F0(Delay display updating during te)131 444 Q +(xt input.)-.15 E F3(This option is not yet implemented.)131 456 Q F1 +(sourceany [off])102 468 Q F0(Read startup \214les not o)131 480 Q +(wned by the current user)-.25 E(.)-.55 E F3(This option will ne)131 492 Q +(ver be implemented.)-.15 E F1(tabstop, ts [8])102 504 Q F0 +(This option sets tab widths for the editor display)131 516 Q(.)-.65 E F1 +(taglength, tl [0])102 528 Q F0 +(Set the number of signi\214cant characters in tag names.)131 540 Q F1 +(tags, tag [tags /var/db/libc.tags /sys/kern/tags])102 552 Q F0 +(Set the list of tags \214les.)131 564 Q F1 +(term, ttytype, tty [environment variable TERM])102 576 Q F0 +(Set the terminal type.)131 588 Q F1(terse [off])102 600 Q F0 .76 +(This option has historically made editor messages less v)131 612 R 3.259 +(erbose. It)-.15 F .759(has no ef)3.259 F .759(fect in this implementa-)-.25 F +(tion.)131 624 Q F1(timeout, to [on])102 636 Q F0 -.35(Ti)131 648 S +(me out on k).35 E -.15(ey)-.1 G 2.5(sw).15 G(hich may be mapped.)209.84 648 Q +F1(ttywerase [off])102 660 Q F2(Vi)131 672 Q F0(only)2.5 E 5(.S)-.65 G +(elect an alternate erase algorithm.)175.69 672 Q F1(verbose [off])102 684 Q F0 +167.75(4.4BSD March)72 750 R(19, 1994)2.5 E(4)535 750 Q EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R(only)131 96 Q 5(.D)-.65 G +(isplay an error message for e)162.85 96 Q -.15(ve)-.25 G(ry error).15 E(.)-.55 +E/F1 10/Courier@0 SF(w300 [no default])102 108 Q/F2 10/Courier-Bold@0 SF(Vi)131 +120 Q F0(only)2.5 E 5(.S)-.65 G(et the windo)175.69 120 Q 2.5(ws)-.25 G +(ize if the baud rate is less than 1200 baud.)238.49 120 Q F1 +(w1200 [no default])102 132 Q F2(Vi)131 144 Q F0(only)2.5 E 5(.S)-.65 G +(et the windo)175.69 144 Q 2.5(ws)-.25 G +(ize if the baud rate is equal to 1200 baud.)238.49 144 Q F1 +(w9600 [no default])102 156 Q F2(Vi)131 168 Q F0(only)2.5 E 5(.S)-.65 G +(et the windo)175.69 168 Q 2.5(ws)-.25 G +(ize if the baud rate is greater than 1200 baud.)238.49 168 Q F1(warn [on])102 +180 Q F2(Ex)131 192 Q F0(only)2.978 E 5.478(.T)-.65 G .479 +(his option causes a w)177.196 192 R .479 +(arning message to the terminal if the \214le has been modi\214ed, since it)-.1 +F -.1(wa)131 204 S 2.5(sl).1 G(ast written, before a)151.73 204 Q/F3 10 +/Times-Bold@0 SF(!)2.5 E F0(command.)2.5 E F1 +(window, w, wi [environment variable LINES])102 216 Q F0(Set the windo)131 228 +Q 2.5(ws)-.25 G(ize for the screen.)199.36 228 Q F1(wrapmargin, wm [0])102 240 +Q F2(Vi)131 252 Q F0(only)2.5 E 5(.B)-.65 G(reak lines automatically when the) +176.8 252 Q 2.5(yr)-.15 G(each the right-hand mar)321.9 252 Q(gin.)-.18 E F1 +(wrapscan, ws [on])102 264 Q F0(Set searches to wrap around the end or be)131 +276 Q(ginning of the \214le.)-.15 E F1(writeany, wa [off])102 288 Q F0 -.45(Tu) +131 300 S(rn of).45 E 2.5<668c>-.25 G(le-o)171.96 300 Q -.15(ve)-.15 G +(rwriting checks.).15 E F3 -.9(FA)72 324 S 1.666(ST ST).9 F(AR)-.9 E(TUP)-.4 E +F0 .467(This section will tell you the minimum amount that you need to do simp\ +le editing tasks using)102 336 R F2(vi)2.966 E F0 2.966(.I)C 2.966(fy)506.584 +336 S(ou')517.88 336 Q -.15(ve)-.5 G(ne)102 348 Q -.15(ve)-.25 G 3.453(ru).15 G +.953(sed an)132.263 348 R 3.453(ys)-.15 G .953(creen editor before, you') +170.679 348 R .953(re lik)-.5 F .953(ely to ha)-.1 F 1.253 -.15(ve p)-.2 H .953 +(roblems e).15 F -.15(ve)-.25 G 3.453(nw).15 G .953 +(ith this simple introduction.)412.286 348 R(In)5.954 E +(that case you should \214nd someone that already kno)102 360 Q(ws)-.25 E F2 +(vi)2.5 E F0(and ha)2.5 E .3 -.15(ve t)-.2 H(hem w).15 E +(alk you through this section.)-.1 E F2(Vi)102 378 Q F0 .294 +(is a screen editor)2.794 F 5.294(.T)-.55 G .294(his means that it tak)198.51 +378 R .293 +(es up almost the entire screen, displaying part of the \214le on each)-.1 F +.001(screen line, e)102 390 R .001(xcept for the last line of the screen.)-.15 +F .002(The last line of the screen is used for you to gi)5.001 F .302 -.15 +(ve c)-.25 H(ommands).15 E(to)102 402 Q F2(vi)2.5 E F0 2.5(,a)C(nd for)133.72 +402 Q F2(vi)2.5 E F0(to gi)2.5 E .3 -.15(ve i)-.25 H(nformation to you.).15 E +.585(The other f)102 420 R .585(act that you need to understand is that)-.1 F +F2(vi)3.085 E F0 .585(is a modeful editor)3.085 F 3.085(,i)-.4 G .584 +(.e. you are either entering te)406.125 420 R .584(xt or)-.15 F .836(you are e) +102 432 R -.15(xe)-.15 G .836(cuting commands, and you ha).15 F 1.137 -.15 +(ve t)-.2 H 3.337(ob).15 G 3.337(ei)301.062 432 S 3.337(nt)311.619 432 S .837 +(he right mode to do one or the other)322.736 432 R 5.837(.Y)-.55 G .837 +(ou will be in)487.209 432 R 1.094 +(command mode when you \214rst start editing a \214le.)102 444 R 1.093 +(There are commands that switch you into input mode.)6.094 F .084 +(There is only one k)102 456 R .384 -.15(ey t)-.1 H .085(hat tak).15 F .085 +(es you out of input mode, and that is the k)-.1 F -.15(ey)-.1 G 5.085 +(.\()-.5 G -2.15 -.25(Ke y)449.895 456 T .085(names are written)2.835 F 1.473 +(using less-than and greater)102 468 R 1.473(-than signs, e.g.)-.2 F 1.473 +( means the `)6.473 F(`escape')-.74 E 3.973('k)-.74 G -.15(ey)420.59 +468 S 3.973(,u)-.5 G 1.473(sually labeled `)440.703 468 R(`esc')-.74 E 3.972 +('o)-.74 G(n)535 468 Q .553(your terminal')102 480 R 3.053(sk)-.55 G -.15(ey) +171.336 480 S 3.053(board.\) If).15 F(you')3.053 E .554(re e)-.5 F -.15(ve)-.25 +G 3.054(rc).15 G .554(onfused as to which mode you')277.45 480 R .554(re in, k) +-.5 F .554(eep entering the )-.1 F -.1(ke)102 492 S 2.615(yu)-.05 G +(ntil)123.805 492 Q F2(vi)2.615 E F0 .115(beeps at you.)2.615 F(\(Generally) +5.115 E(,)-.65 E F2(vi)2.615 E F0 .115 +(will beep at you if you try and do something that')2.615 F 2.614(sn)-.55 G +.114(ot allo)484.472 492 R 2.614(wed. It)-.25 F +(will also display error messages.\))102 504 Q 2.057 -.8(To s)102 522 T .457 +(tart editing a \214le, enter the command `).8 F(`)-.74 E F1 .458 +(vi file_name)B F0 -.74('')C 2.958(.T).74 G .458 +(he command you)470.204 522 R .333 +(should enter as soon as you start editing is `)102 534 R(`)-.74 E F1 .333 +(:set verbose showmode)B F0 -.74('')C 2.833(.T).74 G(his) +528.33 534 Q 1.441(will mak)102 546 R 3.941(et)-.1 G 1.441(he editor gi)149.782 +546 R 1.741 -.15(ve y)-.25 H 1.441(ou v).15 F 1.441 +(erbose error messages and display the current mode at the bottom of the)-.15 F +(screen.)102 558 Q(The commands to mo)102 576 Q .3 -.15(ve a)-.15 H +(round the \214le are:).15 E F3(h)102 588 Q F0(Mo)131 588 Q .3 -.15(ve t)-.15 H +(he cursor left one character).15 E(.)-.55 E F3(j)102 600 Q F0(Mo)131 600 Q .3 +-.15(ve t)-.15 H(he cursor do).15 E(wn one line.)-.25 E F3(k)102 612 Q F0(Mo) +131 612 Q .3 -.15(ve t)-.15 H(he cursor up one line.).15 E F3(l)102 624 Q F0 +(Mo)131 624 Q .3 -.15(ve t)-.15 H(he cursor right one character).15 E(.)-.55 E +F3().1 E F0(The cursor arro)131 +648 Q 2.5(wk)-.25 G -.15(ey)207.01 648 S 2.5(ss).15 G(hould w)226.58 648 Q +(ork, too.)-.1 E F3(/text)-.15 E F0 +(Search for the string `)131 672 Q(`te)-.74 E(xt')-.15 E 2.5('i)-.74 G 2.5(nt) +246.84 672 S(he \214le, and mo)257.12 672 Q .3 -.15(ve t)-.15 H +(he cursor to its \214rst character).15 E(.)-.55 E 167.75(4.4BSD March)72 750 R +(19, 1994)2.5 E(5)535 750 Q EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R(The commands to enter ne)102 96 Q +2.5(wt)-.25 G -.15(ex)220.34 96 S 2.5(ta).15 G(re:)239.35 96 Q/F1 10 +/Times-Bold@0 SF(a)102 108 Q F0(Append ne)131 108 Q 2.5(wt)-.25 G -.15(ex) +186.85 108 S(t,).15 E/F2 10/Times-Italic@0 SF(after)2.5 E F0(the cursor)2.5 E +(.)-.55 E F1(i)102 120 Q F0(Insert ne)131 120 Q 2.5(wt)-.25 G -.15(ex)177.96 +120 S(t,).15 E F2(befor)2.5 E(e)-.37 E F0(the cursor)2.5 E(.)-.55 E F1(o)102 +132 Q F0(Open a ne)131 132 Q 2.5(wl)-.25 G(ine belo)183.79 132 Q 2.5(wt)-.25 G +(he line the cursor is on, and start entering te)227.98 132 Q(xt.)-.15 E F1(O) +102 144 Q F0(Open a ne)131 144 Q 2.5(wl)-.25 G(ine abo)183.79 144 Q .3 -.15 +(ve t)-.15 H(he line the cursor is on, and start entering te).15 E(xt.)-.15 E +F1()102 156 Q F0 .744(Once you')131 168 R 1.044 -.15(ve e)-.5 H .744 +(ntered input mode using the one of the).15 F F1(a)3.244 E F0(,)A F1(i)3.244 E +F0(,)A F1(O)3.244 E F0 3.244(,o)C(r)390.542 168 Q F1(o)3.243 E F0 .743 +(commands, use)3.243 F F1()3.243 E F0 .743(to quit)3.243 F(entering te) +131 180 Q(xt and return to command mode.)-.15 E(The commands to cop)102 198 Q +2.5(yt)-.1 G -.15(ex)200.78 198 S 2.5(ta).15 G(re:)219.79 198 Q F1(yy)102 210 Q +F0(Cop)131 210 Q 2.5(yt)-.1 G(he line the cursor is on.)157.85 210 Q F1(p)102 +222 Q F0(Append the copied line after the line the cursor is on.)131 222 Q +(The commands to delete te)102 240 Q(xt are:)-.15 E F1(dd)102 252 Q F0 +(Delete the line the cursor is on.)131 252 Q F1(x)102 264 Q F0 +(Delete the character the cursor is on.)131 264 Q +(The commands to write the \214le are:)102 282 Q F1(:w)-.15 E F0 .528(Write the \214le back to the \214le with the na\ +me that you originally used as an ar)131 306 R .528(gument on the)-.18 F/F3 10 +/Courier-Bold@0 SF(vi)3.028 E F0(com-)3.028 E(mand line.)131 318 Q F1 +(:w \214le_name)-.15 E F0 +(Write the \214le back to the \214le with the name `)131 342 Q(`\214le_name') +-.74 E('.)-.74 E(The commands to quit editing and e)102 360 Q +(xit the editor are:)-.15 E F1(:q)-.15 E F0 +.848(Quit editing and lea)131 384 R 1.148 -.15(ve v)-.2 H 3.348(i\().15 G .848 +(if you')239.6 384 R 1.148 -.15(ve m)-.5 H .848(odi\214ed the \214le, b).15 F +.848(ut not sa)-.2 F -.15(ve)-.2 G 3.348(dy).15 G .848(our changes,)415.454 384 +R F3(vi)3.347 E F0 .847(will refuse to)3.347 F(quit\).)131 396 Q F1 +(:q!)-.15 E F0(Quit, discarding an)131 420 +Q 2.5(ym)-.15 G(odi\214cations that you may ha)222.51 420 Q .3 -.15(ve m)-.2 H +(ade.).15 E .686(One \214nal caution.)102 438 R .686 +(Unusual characters can tak)5.686 F 3.187(eu)-.1 G 3.187(pm)302.483 438 S .687 +(ore than one column on the screen, and long lines can)318.45 438 R(tak)102 450 +Q 3.129(eu)-.1 G 3.129(pm)126.689 450 S .629(ore than a single screen line.) +142.598 450 R .629(The abo)5.629 F .929 -.15(ve c)-.15 H .629(ommands w).15 F +.629(ork on `)-.1 F(`ph)-.74 E(ysical')-.05 E 3.129('c)-.74 G .628 +(haracters and lines, i.e.)446.476 450 R(the)102 462 Q 2.74(ya)-.15 G -.25(ff) +126.25 462 S .24(ect the entire line no matter ho).25 F 2.74(wm)-.25 G(an) +273.79 462 Q 2.74(ys)-.15 G .241(creen lines it tak)294.71 462 R .241 +(es up and the entire character no matter ho)-.1 F(w)-.25 E(man)102 474 Q 2.5 +(ys)-.15 G(creen columns it tak)130.46 474 Q(es up.)-.1 E F1 -.1(BU)72 498 S +(GS).1 E F0(See the \214le)102 510 Q/F4 10/Courier@0 SF(nvi/docs/bugs.current) +2.5 E F0(for a list of the kno)2.5 E(wn b)-.25 E(ugs in this v)-.2 E(ersion.) +-.15 E F1(FILES)72 534 Q F4(/bin/sh)102 546 Q F0(The def)221 546 Q +(ault user shell.)-.1 E F4(/etc/vi.exrc)102 558 Q F0 +(System-wide vi startup \214le.)221 558 Q F4(/tmp)102 570 Q F0 -.7(Te)221 570 S +(mporary \214le directory).7 E(.)-.65 E F4(/var/tmp/vi.recover)102 582 Q F0 +(Reco)5 E -.15(ve)-.15 G(ry \214le directory).15 E(.)-.65 E F4($HOME/.nexrc)102 +594 Q F0(1st choice for user')221 594 Q 2.5(sh)-.55 G +(ome directory startup \214le.)308.76 594 Q F4($HOME/.exrc)102 606 Q F0 +(2nd choice for user')221 606 Q 2.5(sh)-.55 G(ome directory startup \214le.) +312.09 606 Q F4(.nexrc)102 618 Q F0 +(1st choice for local directory startup \214le.)221 618 Q F4(.exrc)102 630 Q F0 +(2nd choice for local directory startup \214le.)221 630 Q F1 1.666(SEE ALSO)72 +654 R F4(ctags)102 666 Q F0(\(1\),)A F4(more)5 E F0(\(1\),)A F4(curses)5 E F0 +(\(3\),)A F4(dbopen)5 E F0(\(3\))A(The `)102 690 Q(`V)-.74 E 2.5(iQ)-.6 G +(uick Reference')145.09 690 Q 2.5('c)-.74 G(ard.)218.2 690 Q 167.75 +(4.4BSD March)72 750 R(19, 1994)2.5 E(6)535 750 Q EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(EX/VI \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(EX/VI \( 1 \))496.682 48 R -.74(``)102 96 S (Introduction to Display Editing with V).74 E(i')-.6 E(', found in the `)-.74 E -(`UNIX User')-.74 E 2.5(sM)-.55 G(anual Supplementary Documents')397.48 174 Q -('.)-.74 E -.74(``)102 198 S(Edit: A tutorial').74 E(', found in the `)-.74 E -(`UNIX User')-.74 E 2.5(sM)-.55 G(anual Supplementary Documents')300.58 198 Q -('.)-.74 E -.74(``)102 222 S(Ex Reference Manual \(V).74 E(ersion 3.7\)')-1.11 +(`UNIX User')-.74 E 2.5(sM)-.55 G(anual Supplementary Documents')397.48 96 Q +('.)-.74 E -.74(``)102 120 S(Edit: A tutorial').74 E(', found in the `)-.74 E +(`UNIX User')-.74 E 2.5(sM)-.55 G(anual Supplementary Documents')300.58 120 Q +('.)-.74 E -.74(``)102 144 S(Ex Reference Manual \(V).74 E(ersion 3.7\)')-1.11 E(', found in the `)-.74 E(`UNIX User')-.74 E 2.5(sM)-.55 G -(anual Supplementary Documents')381.92 222 Q('.)-.74 E/F3 10/Courier-Bold@0 SF -(Nroff/troff)102 240 Q F1(source for the pre)2.5 E -(vious three documents are distrib)-.25 E(uted with)-.2 E F3(nex/nvi)2.5 E F1 -(in the)2.5 E F2(nvi/docs/USD.doc)102 252 Q F1(directory of the)2.5 E F3 -(nex/nvi)2.5 E F1(source code.)2.5 E(The \214les `)102 276 Q(`auto)-.74 E -(write')-.25 E(', `)-.74 E(`input')-.74 E(', and `)-.74 E(`quoting')-.74 E -(', found in the)-.74 E F2(nvi/docs)2.5 E F1(directory of the)2.5 E F3(nex/nvi) -2.5 E F1(source)2.5 E(code.)102 288 Q F0(HIST)72 312 Q(OR)-.18 E(Y)-.35 E F1 -(The)102 324 Q F3(nex/nvi)2.5 E F1(replacements for)2.5 E F3(ex/vi)2.5 E F1 -(\214rst appeared in 4.4BSD.)2.5 E F0(ST)72 348 Q(AND)-.9 E(ARDS)-.35 E F3 -(Nex/nvi)102 360 Q F1(is f)2.5 E(airly close to IEEE Std1003.2 \(`)-.1 E -(`POSIX')-.74 E('\), b)-.74 E(ut it')-.2 E 2.5(sn)-.55 G(ot there yet.)367.76 -360 Q EP +(anual Supplementary Documents')381.92 144 Q('.)-.74 E/F1 10/Courier-Bold@0 SF +(Nroff/troff)102 162 Q F0(source for the pre)2.5 E +(vious three documents are distrib)-.25 E(uted with)-.2 E F1(nex/nvi)2.5 E F0 +(in the)2.5 E/F2 10/Courier@0 SF(nvi/docs/USD.doc)102 174 Q F0 +(directory of the)2.5 E F1(nex/nvi)2.5 E F0(source code.)2.5 E(The \214les `) +102 198 Q(`auto)-.74 E(write')-.25 E(', `)-.74 E(`input')-.74 E(', `)-.74 E +(`quoting')-.74 E(', and `)-.74 E(`structures')-.74 E(', found in the)-.74 E F2 +(nvi/docs/internals)2.5 E F0(direc-)2.5 E(tory of the)102 210 Q F1(nex/nvi)2.5 +E F0(source code.)2.5 E/F3 10/Times-Bold@0 SF(HIST)72 234 Q(OR)-.18 E(Y)-.35 E +F0(The)102 246 Q F1(nex/nvi)2.5 E F0(replacements for the)2.5 E F1(ex/vi)2.5 E +F0(editor \214rst appeared in 4.4BSD.)2.5 E F3(ST)72 270 Q(AND)-.9 E(ARDS)-.35 +E F1(Nex/nvi)102 282 Q F0 .1(is close to IEEE Std1003.2 \(`)2.6 F(`POSIX')-.74 +E 2.6('\). That)-.74 F .1(document dif)2.6 F .1(fers from historical)-.25 F F1 +(ex/vi)2.6 E F0 .1(practice in)2.6 F(se)102 294 Q -.15(ve)-.25 G +(ral places; there are changes to be made on both sides.).15 E 167.75 +(4.4BSD March)72 750 R(19, 1994)2.5 E(7)535 750 Q EP %%Trailer end %%EOF diff --git a/usr.bin/vi/docs/vi.0.txt b/usr.bin/vi/docs/vi.0.txt index c25ac4fa65d6..4f9588f4584a 100644 --- a/usr.bin/vi/docs/vi.0.txt +++ b/usr.bin/vi/docs/vi.0.txt @@ -1,188 +1,372 @@ +EX/VI(1) BSD Reference Manual EX/VI(1) -NNaammee +NNAAMMEE eexx,, vvii,, vviieeww - text editors SSYYNNOOPPSSIISS - vvii [--eeFFllRRvv] [--cc _c_o_m_m_a_n_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] - vviieeww [--eeFFllRRvv] [--cc _c_o_m_m_a_n_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] - eexx [--eeFFllRRssvv] [--cc _c_o_m_m_a_n_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] + eexx [--eeFFllRRssvv] [--cc _c_m_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] [_f_i_l_e _._._.] + vvii [--eeFFllRRvv] [--cc _c_m_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] [_f_i_l_e _._._.] + vviieeww [--eeFFllRRvv] [--cc _c_m_d] [--rr _f_i_l_e] [--tt _t_a_g] [--ww _s_i_z_e] [--xx _a_w] [_f_i_l_e _._._.] DDEESSCCRRIIPPTTIIOONN - EExx is a line-oriented text editor. VVii is a screen oriented text editor, - based on eexx. VViieeww is the same as using the --RR (read-only) option of vvii. - EExx and vvii are really different interfaces to the same program, and it is - possible to switch back and forth during the same edit session. + VVii is a screen oriented text editor. EExx is a line-oriented text editor. + EExx and vvii are different interfaces to the same program, and it is possi- + ble to switch back and forth during an edit session. VViieeww is the equiva- + lent of using the --RR (read-only) option of vvii. - This manual page is the one provided with the nneexx and nnvvii versions of the - vi text editors. NNeexx and nnvvii are intended as bug-for-bug compatible re- + This manual page is the one provided with the nneexx//nnvvii versions of the + eexx//vvii text editors. NNeexx//nnvvii are intended as bug-for-bug compatible re- placements for the original Fourth Berkeley Software Distribution (4BSD) - eexx and vvii programs. + eexx and vvii programs. For the rest of this manual page, nneexx//nnvvii is used + only when it's necessary to distinguish it from the historic implementa- + tions of eexx//vvii. + + This manual page is intended for users already familiar with eexx//vvii. Any- + one else should almost certainly read a good tutorial on the editor be- + fore this manual page. If you're in an unfamiliar environment, and you + absolutely have to get work done immediately, read the section near the + end of this manual page, entitled FAST STARTUP. It's probably enough to + get you going. The following options are available: - --cc Execute _c_o_m_m_a_n_d immediately after starting the edit session. - Useful for initial positioning in the file, but _c_o_m_m_a_n_d is not - limited to positioning commands. This is the POSIX 1003.2 inter- - face for the historic ``+command'' syntax. NNeexx//nnvvii supports both - the old and new syntax. + --cc Execute _c_m_d immediately after starting the edit session. Partic- + ularly useful for initial positioning in the file, however _c_m_d is + not limited to positioning commands. This is the POSIX 1003.2 + interface for the historic ``+cmd'' syntax. NNeexx//nnvvii supports + both the old and new syntax. - --ee Start editing in ex mode, as if the command name was eexx. + --ee Start editing in ex mode, as if the command name were eexx. --FF Don't copy the entire file when first starting to edit. (The de- - fault is to make a copy in case someone else tries to edit the - file too.) + fault is to make a copy in case someone else modifies the file + during your edit session.) --ll List the files that may be recovered using the --rr option of vvii. - This is the new interface for the historic --rr without a file ar- - gument syntax. NNeexx//nnvvii supports both the old and new syntax. + This is the new interface for the historic syntax of the --rr op- + tion without a file argument. NNeexx//nnvvii supports both the old and + new syntax. - --RR Start editing in read-only mode, as if the command name was vviieeww. + --RR Start editing in read-only mode, as if the command name was vviieeww, + or the readonly option was set. --rr Recover the specified file. --ss Enter batch mode; applicable only to eexx edit sessions. Batch mode is useful when running eexx scripts. Prompts, informative - messages and other user oriented things are turned off. This is - the POSIX 1003.2 interface for the historic ---- syntax. NNeexx//nnvvii + messages and other user oriented message are turned off, and no + startup files or environmental variables are read. This is the + POSIX 1003.2 interface for the historic ``-'' argument. NNeexx//nnvvii supports both the old and new syntax. --tt Start editing at the specified tag. (See ctags(1)). + + --ww Set the initial window size to the specified number of lines. --vv Start editing in vi mode, as if the command name was vvii or vviieeww. - --xx Reserved for X11 interfaces. Not currently implemented. + --xx Reserved for X11 interfaces. _N_o _X_1_1 _s_u_p_p_o_r_t _i_s _c_u_r_r_e_n_t_l_y + _i_m_p_l_e_m_e_n_t_e_d_. -AADDDDIITTIIOONNAALL FFEEAATTUURREESS - This manual page is the one distributed with the nnvvii and nneexx reimplemen- - tations of eexx//vvii. There are a few additional features in nneexx//nnvvii. + EExx//vvii exit 0 on success, and greater than 0 if an error occurs. - 8-bit clean data, large lines, files - NNvvii//nneexx will edit any format file. Line lengths are limited by - available memory, and file sizes are limited by available disk - space. The command ``^Vx[0-9A-Fa-f]*'', in input mode, will in- +EENNVVIIRROONNMMEENNTTAALL VVAARRIIAABBLLEESS + COLUMNS + The number of columns on the screen. This value overrides any sys- + tem or terminal specific values. If the COLUMNS environmental + variable is not set when eexx//vvii runs, or the ccoolluummnnss option is ex- + plicitly reset by the user, eexx//vvii enters the value into the envi- + ronment. + EXINIT + A list of eexx startup commands, read if the variable NEXINIT is not + set. + HOME The user's home directory, used as the initial directory path for + the startup _$_H_O_M_E_/_._n_e_x_r_c and _$_H_O_M_E_/_._e_x_r_c files. This value is also + used as the default directory for the vvii ccdd command. + LINES + The number of rows on the screen. This value overrides any system + or terminal specific values. If the LINES environmental variable + is not set when eexx//vvii runs, or the lliinneess option is explicitly reset + by the user, eexx//vvii enters the value into the environment. + NEXINIT + A list of eexx startup commands. + SHELL + The user's shell of choice (see also the sshheellll option). + TERM The user's terminal type. The default is the type ``unknown''. If + the TERM environmental variable is not set when eexx//vvii runs, or the + tteerrmm option is explicitly reset by the user, eexx//vvii enters the value + into the environment. + TMPDIR + The location used to stored temporary files (see also the ddiirreeccttoorryy + option). + +SSEETT OOPPTTIIOONNSS + 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 abbre- + viations and their default values. + + In each entry below, the first part of the tag line is the full name of + the option, followed by any equivalent abbreviations. 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. + + Options apply to both eexx and vvii modes, unless otherwise specified. + altwerase [off] + VVii only. Select an alternate word erase algorithm. + autoindent, ai [off] + Automatically indent new lines. + autoprint, ap [off] + EExx only. Display the current line automatically. + autowrite, aw [off] + Write modified files automatically when changing files. + beautify, bf [off] + Discard control characters. + cdpath [environment variable CDPATH, or ``.''] + The directory paths used as path prefixes for the ccdd command. + columns, co [80] - sert any legal character value into the text. + Set the number of columns in the screen. + comment [off] + VVii only. Skip leading comments in files. + directory, dir [environment variable TMPDIR, or /tmp] + The directory where temporary files are created. + edcompatible, ed [off] + Modify the behavior of certain suffices for the eexx ssuubbssttiittuuttee com- + mand. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + errorbells, eb [off] + EExx only. Precede error messages with a bell. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + exrc, ex [off] + Never read startup files in the local directory. + extended [off] + Regular expressions are extended (i.e. egrep(1) style) expres- + sions. + flash [on] + Flash the screen instead of beeping the keyboard on error. + hardtabs, ht [8] + Set the spacing between hardware tab settings. + ignorecase, ic [off] + Ignore case differences in regular expressions. + keytime [6] + The 10th's of a second eexx//vvii waits for a subsequent key to complete + a key mapping. + leftright [off] + VVii only. Do left-right scrolling. + lines, li [24] + VVii only. Set the number of lines in the screen. + lisp [off] + VVii only. Modify various search commands and options to work with + Lisp. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + list [off] + Display lines in an unambiguous fashion. + magic [on] + Treat certain characters specially in regular expressions. + matchtime [7] + VVii only. The 10th's of a second eexx//vvii pauses on the matching char- + acter when the sshhoowwmmaattcchh option is set. + mesg [on] + Permit messages from other users. + modelines, modeline [off] + Read the first and last few lines of each file for eexx commands. + _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_. + number, nu [off] + Precede each line displayed with its current line number. + open [on] + EExx only. If this option is not set, the ooppeenn and vviissuuaall commands + are disallowed. + optimize, opt [on] + VVii only. Optimize text throughput to dumb terminals. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + paragraphs, para [IPLPPPQPP LIpplpipbp] + VVii only. Define additional paragraph boundaries for the {{ and }} + commands. + prompt [on] + EExx only. Display a command prompt. + readonly, ro [off] + Mark the file as read-only. + recdir [/var/tmp/vi.recover] + The directory where recovery files are stored. + redraw, re [off] + VVii only. Simulate an intelligent terminal on a dumb one. - Split screens - The command ``:sp[lit] [file ...]'' splits the screen in vi mode. - The key ``^W'' switches between the foreground screens, and the - ``:resize count'' command can be used to grow or shrink any par- - ticular screen. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + remap [on] + Remap keys until resolved. + remapmax [on] + Limit the number of times a key may be remapped. + report [5] + Set the number of lines about which the editor reports changes. + ruler [off] + VVii only. Display a row/column ruler on the colon command line. + scroll, scr [window / 2] + Set the number of lines scrolled. + sections, sect [NHSHH HUnhsh] + VVii only. Define additional section boundaries for the [[[[ and ]]]] + commands. + shell, sh [environment variable SHELL, or /bin/sh] + Select the shell used by the editor. + shiftwidth, sw [8] + Set the autoindent and shift command indentation width. + showdirty [off] + VVii only. Display an asterisk on the colon command line if the file + has been modified. + showmatch, sm [off] + VVii only. Note matching ``{'' and ``('' for ``}'' and ``)'' charac- + ters. + showmode [off] + VVii only. Display the current editor mode (command or input). + sidescroll [16] + VVii only. Set the amount a left-right scroll will shift. + slowopen, slow [off] + Delay display updating during text input. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + sourceany [off] + Read startup files not owned by the current user. + _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_. + tabstop, ts [8] + This option sets tab widths for the editor display. + taglength, tl [0] + Set the number of significant characters in tag names. + tags, tag [tags /var/db/libc.tags /sys/kern/tags] + Set the list of tags files. + term, ttytype, tty [environment variable TERM] + Set the terminal type. + terse [off] + This option has historically made editor messages less verbose. It + has no effect in this implementation. + timeout, to [on] + Time out on keys which may be mapped. + ttywerase [off] + VVii only. Select an alternate erase algorithm. + verbose [off] + only. Display an error message for every error. + w300 [no default] + VVii only. Set the window size if the baud rate is less than 1200 + baud. + w1200 [no default] + VVii only. Set the window size if the baud rate is equal to 1200 + baud. + w9600 [no default] + VVii only. Set the window size if the baud rate is greater than 1200 + baud. + warn [on] + EExx only. This option causes a warning message to the terminal if + the file has been modified, since it was last written, before a !! + command. + window, w, wi [environment variable LINES] - Background and foreground screens - The command ``:bg'' backgrounds the current screen, and the com- - mand ``:fg [file]'' foregrounds the backgrounded screeen that is - editing the specified file, or, by default, the first background - screen on the queue. The command ``:di[splay] s[creens]'' lists - the background screens. + Set the window size for the screen. + wrapmargin, wm [0] + VVii only. Break lines automatically when they reach the right-hand + margin. + wrapscan, ws [on] + Set searches to wrap around the end or beginning of the file. + writeany, wa [off] + Turn off file-overwriting checks. - Shell screens - The command ``:sc[ript] [file ...]'' runs a shell in the screen. - Editing is unchanged, with the exception that a - enters the current line (stripped of any prompt) as input to the - shell. +FFAASSTT SSTTAARRTTUUPP + This section will tell you the minimum amount that you need to do simple + editing tasks using vvii. If you've never used any screen editor before, + you're likely to have problems even with this simple introduction. In + that case you should find someone that already knows vvii and have them + walk you through this section. - Tag stacks - Tags are now maintained in a stack. The command ``^T'' returns - to the previous tag location. The command ``:tagpop [number - file]'' 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 the specified file. Use the command ``:di[splay] - t[ags]'' to view the tags stack. The command ``:tagtop'' returns - to the top of the tag stack. + VVii is a screen editor. This means that it takes up almost the entire + screen, displaying part of the file on each screen line, except for the + last line of the screen. The last line of the screen is used for you to + give commands to vvii, and for vvii to give information to you. - New displays - The command ``:di[splay] b[uffers] s[creens] t[ags]'' can be - used to display, respectively, the current cut buffers, the back- - grounded screens, and the tags stack. + The other fact that you need to understand is that vvii is a modeful edi- + tor, i.e. you are either entering text or you are executing commands, and + you have to be in the right mode to do one or the other. You will be in + command mode when you first start editing a file. There are commands + that switch you into input mode. There is only one key that takes you + out of input mode, and that is the key. (Key names are written + using less-than and greater-than signs, e.g. means the + ``escape'' key, usually labeled ``esc'' on your terminal's keyboard.) If + you're ever confused as to which mode you're in, keep entering the key until vvii beeps at you. (Generally, vvii will beep at you if you + try and do something that's not allowed. It will also display error mes- + sages.) - Infinite undo - The changes made during an edit session may be rolled backward - and forward. A '.' command immediately after a 'u' command con- - tinues either forward or backward depending on whether the 'u' - command was an undo or a redo. + To start editing a file, enter the command ``vi file_name''. The command you should enter as soon as you start editing is + ``:set verbose showmode''. This will make the editor + give you verbose error messages and display the current mode at the bot- + tom of the screen. - Usage information - The command ``:exu[sage [cmd]'' and ``viu[sage] [key]'' provide - usage information for all of the ex and vi commands by default, - or, optionally, for a specific command or key. + The commands to move around the file are: + hh Move the cursor left one character. + jj Move the cursor down one line. + kk Move the cursor up one line. + ll Move the cursor right one character. + <> + The cursor arrow keys should work, too. + //tteexxtt<> + Search for the string ``text'' in the file, and move the cursor to + its first character. - Extended regular expressions - The ``:set extended'' command treats search and other command - regular expressions as extended (egrep(1) style) regular expres- - sions. + The commands to enter new text are: + aa Append new text, _a_f_t_e_r the cursor. + ii Insert new text, _b_e_f_o_r_e the cursor. + oo Open a new line below the line the cursor is on, and start entering + text. + OO Open a new line above the line the cursor is on, and start entering + text. + <> + Once you've entered input mode using the one of the aa, ii, OO, or oo + commands, use <> to quit entering text and return to command + mode. - Word search - The command ``^A'' searches for the word referenced by the cur- - sor. + The commands to copy text are: - Number increment - The command ``#'' increments the number referenced by the cursor. - Previous file - The command ``:prev[ious][!]'' edits the previous file from the - argument list. + yyyy Copy the line the cursor is on. + pp Append the copied line after the line the cursor is on. - Left-Right scrolling - The command ``:set leftright'' makes nnvvii do left-right screen - scrolling, instead of the traditional vvii line wrapping. + The commands to delete text are: + dddd Delete the line the cursor is on. + xx Delete the character the cursor is on. -RREECCOOVVEERRYY - There is no recovery program for nvi, nor does it run setuid. Users may - recover any file which they may read, and the superuser may recover any - edit session. + The commands to write the file are: + ::ww<> + Write the file back to the file with the name that you originally + used as an argument on the vvii command line. + ::ww ffiillee__nnaammee<> + Write the file back to the file with the name ``file_name''. - Edit sessions are backed by files in _/_v_a_r_/_t_m_p_/_v_i_._r_e_c_o_v_e_r, and are named - ``vi.XXXX'', where ``XXXX'' is a number related to the process id. When - a file is first modified, a second file, which contains an email message - for the user, is created, and is named ``recover.XXXX'', where, again, - ``XXXX'' 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 enters the ex/vi ``preserve'' command. - The use of the _/_v_a_r_/_t_m_p directory may be changed setting the option - ``recdir'' in the user's or system startup information. + The commands to quit editing and exit the editor are: + ::qq<> + Quit editing and leave vi (if you've modified the file, but not + saved your changes, vvii will refuse to quit). + ::qq!!<> + Quit, discarding any modifications that you may have made. - The recovery directory should have the ``sticky-bit'' set so that only - the owners of files may remove them. If this is not possible on the sys- - tem, then a pseudo-user should own the recovery directory. The recovery - directory must be both read and write-able by any user. - - 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 sendmail. When the system is rebooted, all - of the files in _/_v_a_r_/_t_m_p_/_v_i_._r_e_c_o_v_e_r named ``recover.XXXX'' should be sent - by email, using the --tt flag of sendmail (or a similar mechanism in other - mailers). A simple way to do this is to insert the following script into - your rc.local (or other startup) file: - - # Recover nvi editor files. - virecovery=/var/tmp/vi.recover/recover.* - if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then - echo 'Recovering vi editor sessions' - for i in $virecovery; do - sendmail -t < $i - done - fi - - If nneexx//nnvvii receives a hangup (SIGHUP) signal, it will email the recovery - information to the user itself. - - If you don't have the sendmail program on your system, the source file - _n_v_i_/_r_e_c_o_v_e_r_._c will have to be modified to use your mail delivery pro- - grams. + One final caution. Unusual characters can take up more than one column + on the screen, and long lines can take up more than a single screen line. + The above commands work on ``physical'' characters and lines, i.e. they + affect the entire line no matter how many screen lines it takes up and + the entire character no matter how many screen columns it takes up. BBUUGGSS - This man page is woefully incomplete. - - Many and varied. See the file _n_v_i_/_d_o_c_s_/_b_u_g_s_._c_u_r_r_e_n_t for a list of the - known bugs in this version. + See the file _n_v_i_/_d_o_c_s_/_b_u_g_s_._c_u_r_r_e_n_t for a list of the known bugs in this + version. FFIILLEESS - /tmp Storage for temporary files. - /var/tmp/vi.recover Storage for recovery files. + /bin/sh The default user shell. + /etc/vi.exrc System-wide vi startup file. + /tmp Temporary file directory. + /var/tmp/vi.recover Recovery file directory. + $HOME/.nexrc 1st choice for user's home directory startup file. + $HOME/.exrc 2nd choice for user's home directory startup file. + .nexrc 1st choice for local directory startup file. + .exrc 2nd choice for local directory startup file. SSEEEE AALLSSOO ctags(1), more(1), curses(3), dbopen(3) @@ -201,64 +385,15 @@ SSEEEE AALLSSOO NNrrooffff//ttrrooffff source for the previous three documents are distributed with nneexx//nnvvii in the _n_v_i_/_d_o_c_s_/_U_S_D_._d_o_c directory of the nneexx//nnvvii source code. - The files ``autowrite'', ``input'', and ``quoting'', found in the - _n_v_i_/_d_o_c_s directory of the nneexx//nnvvii source code. + The files ``autowrite'', ``input'', ``quoting'', and ``structures'', + found in the _n_v_i_/_d_o_c_s_/_i_n_t_e_r_n_a_l_s directory of the nneexx//nnvvii source code. HHIISSTTOORRYY - The nneexx//nnvvii replacements for eexx//vvii first appeared in 4.4BSD. + The nneexx//nnvvii replacements for the eexx//vvii editor first appeared in 4.4BSD. SSTTAANNDDAARRDDSS - NNeexx//nnvvii is fairly close to IEEE Std1003.2 (``POSIX''), but it's not there - yet. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + NNeexx//nnvvii is close to IEEE Std1003.2 (``POSIX''). That document differs + from historical eexx//vvii practice in several places; there are changes to be + made on both sides. +4.4BSD March 19, 1994 7 diff --git a/usr.bin/vi/docs/vi.ref b/usr.bin/vi/docs/vi.ref new file mode 100644 index 000000000000..afdd2ed1769f --- /dev/null +++ b/usr.bin/vi/docs/vi.ref @@ -0,0 +1,544 @@ +.\" Copyright (c) 1994 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)vi.ref 8.19 (Berkeley) 3/18/94 +.\" +.Dd "March 18, 1994" +.Dt "EX/VI REFERENCE MANUAL" 1 +.Os +.Sh NAME +.Nm ex, vi, view +.Nd text editors +.Sh DESCRIPTION +.Nm \&Vi +is a screen oriented text editor. +.Nm \&Ex +is a line-oriented text editor. +.Nm \&Ex +and +.Nm \&vi +are different interfaces to the same program, +and it is possible to switch back and forth during an edit session. +.Nm View +is the equivalent of using the +.Fl R +(read-only) option of +.Nm \&vi . +.Pp +This reference manual is the one provided with the +.Nm nex/nvi +versions of the +.Nm ex/vi +text editors. +.Nm Nex/nvi +are intended as bug-for-bug compatible replacements for the original +Fourth Berkeley Software Distribution (4BSD) +.Nm \&ex +and +.Nm \&vi +programs. +This reference manual is accompanied by a traditional-style manual page. +That manual page describes the functionality found in +.Nm ex/vi +in far less detail than the description here. +In addition, it describes the system interface to +.Nm ex/vi , +e.g. command line options, environmental variables, and similar things. +.Pp +This reference is intended for users already familiar with +.Nm ex/vi . +Anyone else should almost certainly read a good tutorial on the +editor first. +If you're in an unfamiliar environment, and you absolutely have to +get work done immediately, see the section entitled FAST STARTUP +in the manual page. +It's probably enough to get you going. +.Pp +For the rest of this reference, +.Nm nex/nvi +is used only when it's necessary to distinguish it from the historic +implementations of +.Nm ex/vi . +.Sh ADDITIONAL FEATURES +There are a few features in +.Nm nex/nvi +that are not found in historic versions of +.Nm ex/vi . +A list of those features is as follows: +.Bl -tag -width indent +.It "8-bit clean data, large lines, files" +.Nm \&Nvi/nex +will edit any format file. +Line lengths are limited by available memory, +and file sizes are limited by available disk space. +The command +.Dq "^Vx[0-9A-Fa-f]* ," +in input mode, will insert any +legal character value into the text. +.It "Split screens" +The command +.Dq ":sp[lit] [file ...]" +splits the screen in vi mode. +The key +.Dq "^W" +switches between the foreground screens, +and the +.Dq ":resize count" +command can be used to grow or shrink a particular screen. +.It "Background and foreground screens" +The command +.Dq ":bg" +backgrounds the current screen, +and the command +.Dq ":fg [file]" +foregrounds the backgrounded screen +that is editing the specified file, or, by default, the first background +screen on the queue. +The command +.Dq ":di[splay] s[creens]" +lists the background screens. +.It "Shell screens" +The command +.Dq ":sc[ript] [file ...]" +runs a shell in the screen. +Editing is unchanged, with the exception that a +enters the current line (stripped of any prompt) as input to the +shell. +.It "Tag stacks" +Tags are now maintained in a stack. +The command +.Dq "^T" +returns to the previous tag location. +The command +.Dq ":tagpop [number \| file]" +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 the specified file. +Use the command +.Dq ":di[splay] t[ags]" +to view the tags stack. +The command +.Dq ":tagtop" +returns to the top of the tag stack. +.It "New displays" +The command +.Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]" +can be +used to display, respectively, the current cut buffers, +the backgrounded screens, and the tags stack. +.It "Infinite undo" +The changes made during an edit session may be rolled backward and +forward. +A '.' command immediately after a 'u' command continues either forward +or backward depending on whether the 'u' command was an undo or a redo. +.It "Usage information" +The command +.Dq ":exu[sage] [cmd]" +and +.Dq "viu[sage] [key]" +provide usage +information for all of the ex and vi commands by default, or, optionally, +for a specific command or key. +.It "Extended regular expressions" +The +.Dq ":set extended" +command treats search and other command regular +expressions as extended (egrep(1) style) regular expressions. +.It "Word search" +The command +.Dq "^A" +searches for the word referenced by the cursor. +.It "Number increment" +The command +.Dq "#" +increments the number referenced by the cursor. +.It "Previous file" +The command +.Dq ":prev[ious][!]" +edits the previous file from the +argument list. +.It "Left-Right scrolling" +The command +.Dq ":set leftright" +makes +.Nm nvi +do left-right screen scrolling, instead of the traditional +.Nm \&vi +line wrapping. +.Sh RECOVERY +There is no recovery program for +.Nm nvi , +nor does +.Nm nvi +run setuid. +Users may recover any file which they may read, and the superuser +may recover any edit session. +.Pp +Edit sessions are backed by files in +.Pa /var/tmp/vi.recover , +and are named +.Dq "vi.XXXX" , +where +.Dq "XXXX" +is a number related to the process id. +When a file is first modified, a second file, which contains an +email message for the user, is created, and is named +.Dq "recover.XXXX" , +where, again, +.Dq "XXXX" +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 enters the ex/vi +.Dq "preserve" +command. +The use of the +.Pa /var/tmp +directory may be changed setting the +.Sy recdir +option in the user's or system startup information. +.Pp +The recovery directory should have the +.Dq "sticky-bit" +set so that only the owners of files may remove them. +If this is not possible on the system, then a pseudo-user should +own the recovery directory. +The recovery directory must be both read and write-able by +any user. +.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 sendmail. +When the system is rebooted, all of the files in +.Pa /var/tmp/vi.recover +named +.Dq "recover.XXXX" +should be sent by email, +using the +.Fl t +flag of sendmail (or a similar mechanism in other mailers). +A simple way to do this is to insert the following script into your +.Pa /etc/rc.local +(or other startup) file: +.ne 7v +.Bd -literal -offset indent -compact +# Recover nvi editor files. +virecovery=`echo /var/tmp/vi.recover/recover.*` +if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then + echo 'Recovering vi editor sessions' + for i in $virecovery; do + sendmail -t < $i + done +fi +.Ed +.Pp +If +.Nm ex/vi +receives a hangup (SIGHUP) signal, it will email the recovery +information to the user itself. +.Pp +If you don't have the sendmail program on your system, the source file +.Pa nvi/recover.c +will have to be modified to use your local mail delivery programs. +.Sh STARTUP INFORMATION +.Nm 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 +.Nm \&ex +commands, not +.Nm \&vi +commands. +In addition, they are interpreted +.Em before +the file to be edited is read, and therefore many +.Nm \&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 +First, the file +.Pa /etc/vi.exrc +is read. +Second, the environmental variable +.Ev NEXINIT +(or the variable +.Ev EXINIT , +if +.Ev NEXINIT +isn't set) is interpreted. +Third, if neither +.Ev NEXINIT +or +.Ev EXINIT +was set, the file +.Pa $HOME/.nexrc +(or the file +.Pa $HOME/.exrc , +if +.Pa $HOME/.nexrc +doesn't exist) is read. +Fourth, the file +.Pa .nexrc +(or the file +.Pa .exrc , +if +.Pa .nexrc +doesn't exist) is read. +.Pp +Startup files will not be read if they are owned by anyone other +than the real user-id of the user running +.Nm \&vi , +(or by +.Dq root +in the case of the file +.Pa /etc/vi.exrc ) +or if they are writable by anyone other than the owner. +Home directory startup files (i.e. +.Pa $HOME/.nexrc +and +.Pa $HOME/.exrc ) +will not be read if the +.Dq HOME +environmental variable is not set. +Local startup files (i.e. +.Pa .nexrc +and +.Pa .exrc ) +will not be read if the +.Sy exrc +option is turned off in the +.Pa /etc/vi.exrc , +.Pa $HOME/.nexrc , +or +.Pa $HOME/.exrc +files, or in the +.Ev NEXINIT +or +.Ev EXINIT +environmental variables. +It is not an error for any of the startup environmental variables +or files not to exist. +.Pp +Because the +.Nm \&ex +command set supported by +.Nm nex/nvi +is a superset of the command set supported by most historical implementations +of +.Nm \&ex , +.Nm nex/nvi +can use the startup files created for the historical implementations, +but the converse is often not true. +.Sh SIZING THE SCREEN +The size of the screen can be set in a number of ways. +.Nm Ex/vi +takes the following steps until values are obtained for both the +number of rows and number of columns in the screen. +.sp +.Bl -enum -compact +.It +If the environmental variable +.Ev LINES +exists, it is used to specify the number of rows in the screen. +.It +If the environmental variable +.Ev COLUMNS +exists, it is used to specify the number of columns in the screen. +.It +The TIOCGWINSZ +.Xr ioctl 2 +is attempted on the standard error file descriptor. +.It +The termcap entry is checked for the +.Dq \&li +entry (rows) and the +.Dq \&co +entry (columns). +.It +The number of rows is set to 24, and the number of columns is set +to 80. +.El +.Pp +If a window change size signal (SIGWINCH) is received, +the same steps are taken with the exception that the first two steps +are skipped. +.Sh REGULAR EXPRESSIONS AND REPLACEMENT STRINGS +Regular expressions are used in line addresses, +as the first part of +.Sy substitute , +.Sy global , +and +.Sy vglobal +commands, +and in search patterns. +.Pp +The regular expressions supported by +.Nm \&ex +and +.Nm \&vi +are, by default, the Basic Regular Expressions (BRE's) described in the +IEEE POSIX Standard 1003.2. +The +.Sy 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 +for more information. +Generally speaking, BRE's are +.Xr ed 1 +and +.Xr grep 1 +style regular expressions, and ERE's are +.Xr egrep 1 +style regular expressions.) +.Pp +There are some special strings and characters that can be used in +RE's: +.Bl -enum -compact +.It +An empty RE (e.g. +.Dq \&// ) +is equivalent to the last RE used. +.It +The construct +.Dq \e< +matches the beginning of a word. +.It +The construct +.Dq \e> +matches the end of a word. +.It +The character +.Dq \&~ +matches the replacement part of the last +.Sy substitute +command. +.El +.Pp +When the +.Sy magic +option is +.Em not +set, +the only characters with special meanings are +.Dq \&^ +at the beginning of an RE, +.Dq \&$ +at the end of an RE, and the escaping character +.Dq \&\e . +The characters +.Dq \&. , +.Dq \&* , +.Dq \&[ , +and +.Dq \&~ +are treated as ordinary characters unless preceded by a +.Dq \&\e ; +when preceded by a +.Dq \&\e +they regain their special meaning. +.Pp +Replacement strings are the second part of a +.Sy substitute +command. +.Pp +The character +.Dq \&& +(or +.Dq \e& +if the +.Sy magic +option is +.Em not +set) in the replacement string stands for the text matched by the RE +that's being replaced. +The character +.Dq \&~ +(or +.Dq \e~ +if the +.Sy magic +option is +.Em not +set) stands for the replacement part of the previous +.Sy substitute +command. +.Pp +The string +.Dq \e# , +where +.Dq \&# +is an integer value from 1 to 9, stands for the text matched by +the portion of the RE enclosed in the #'th set of escaped parentheses, +e.g. +.Dq \e( +and +.Dq \e) . +For example, +.Dq "s/abc\e(.*\e)def/\e1/" +deletes the strings +.Dq abc +and +.Dq def +from the matched pattern. +.Pp +The strings +.Dq \el , +.Dq \eu , +.Dq \eL , +and +.Dq \eU +can be used to modify the case of elements in the replacement string. +The string +.Dq \el +causes the next character to be converted to lowercase; the string +.Dq \eu +behaves similarly, but converts to uppercase. +The strings +.Dq \eL +causes characters up to the end of the string or the next occurrence of +the strings +.Dq \ee +or +.Dq \eE +to be converted to lowercase; the string +.Dq \eU +behaves similarly, but converts to uppercase. +.Pp +In +.Nm \&vi , +inserting a into the replacement string will cause the +matched line to be split into two lines at that point. +.Sh SET OPTIONS +#include diff --git a/usr.bin/vi/docs/vi.ref.ps b/usr.bin/vi/docs/vi.ref.ps new file mode 100644 index 000000000000..b5cc15e64fc8 --- /dev/null +++ b/usr.bin/vi/docs/vi.ref.ps @@ -0,0 +1,1108 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.08 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Courier-Bold +%%+ font Symbol +%%+ font Courier +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.08 0 +%%Pages: 10 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.08 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Courier-Bold +%%IncludeResource: font Symbol +%%IncludeResource: font Courier +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL +792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron +/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space +/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft +/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four +/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C +/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash +/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q +/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase +/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger +/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar +/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus +/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu +/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright +/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde +/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute +/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute +/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve +/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex +/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE +/Courier@0 ENC0/Courier RE/Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 +ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F/F1 10/Times-Bold@0 SF -.2(NA)72 108 S(ME).2 E/F2 10 +/Courier-Bold@0 SF(ex, vi, view)102 120 Q F0 2.52.5 G -.15(ex)187.42 120 +S 2.5(te).15 G(ditors)206.43 120 Q F1(DESCRIPTION)72 144 Q F2(Vi)102 156 Q F0 +.176(is a screen oriented te)2.676 F .176(xt editor)-.15 F(.)-.55 E F2(Ex)5.176 +E F0 .176(is a line-oriented te)2.676 F .175(xt editor)-.15 F(.)-.55 E F2(Ex) +5.175 E F0(and)2.675 E F2(vi)2.675 E F0 .175(are dif)2.675 F .175 +(ferent interf)-.25 F .175(aces to the)-.1 F .56(same program, and it is possi\ +ble to switch back and forth during an edit session.)102 168 R F2(View)5.561 E +F0 .561(is the equi)3.061 F -.25(va)-.25 G .561(lent of).25 F(using the)102 180 +Q F24.166 E F0(\(read-only\) option of)2.5 E F2(vi)2.5 E F0(.)A .004 +(This reference manual is the one pro)102 198 R .004(vided with the)-.15 F F2 +(nex/nvi)2.504 E F0 -.15(ve)2.504 G .004(rsions of the).15 F F2(ex/vi)2.503 E +F0(te)2.503 E .003(xt editors.)-.15 F F2(Nex/nvi)5.003 E F0 .55 +(are intended as b)102 210 R(ug-for)-.2 E(-b)-.2 E .55 +(ug compatible replacements for the original F)-.2 F .55(ourth Berk)-.15 F(ele) +-.1 E 3.05(yS)-.15 G(oftw)458.37 210 Q .55(are Distrib)-.1 F(ution)-.2 E +(\(4BSD\))102 222 Q F2(ex)3.804 E F0(and)3.804 E F2(vi)3.804 E F0 3.804 +(programs. This)3.804 F 1.303 +(reference manual is accompanied by a traditional-style manual page.)3.804 F +.399(That manual page describes the functionality found in)102 234 R F2(ex/vi) +2.899 E F0 .399(in f)2.899 F .399(ar less detail than the description here.)-.1 +F(In)5.399 E 1.211(addition, it describes the system interf)102 246 R 1.211 +(ace to)-.1 F F2(ex/vi)3.711 E F0 3.711(,e)C 1.211 +(.g. command line options, en)329.338 246 R 1.21(vironmental v)-.4 F(ariables,) +-.25 E(and similar things.)102 258 Q .087 +(This reference is intended for users already f)102 276 R .087(amiliar with)-.1 +F F2(ex/vi)2.588 E F0 2.588(.A)C -.15(ny)374.652 276 S .088 +(one else should almost certainly read a).15 F .266 +(good tutorial on the editor \214rst.)102 288 R .266(If you')5.266 F .266 +(re in an unf)-.5 F .265(amiliar en)-.1 F .265 +(vironment, and you absolutely ha)-.4 F .565 -.15(ve t)-.2 H 2.765(og).15 G +.265(et w)509.565 288 R(ork)-.1 E .354(done immediately)102 300 R 2.854(,s)-.65 +G .354(ee the section entitled F)182.888 300 R .354(AST ST)-.74 F(AR)-.93 E +.354(TUP in the manual page.)-.6 F(It')5.355 E 2.855(sp)-.55 G .355 +(robably enough to get)451.445 300 R(you going.)102 312 Q -.15(Fo)102 330 S +3.261(rt).15 G .761(he rest of this reference,)121.781 330 R F2(nex/nvi)3.261 E +F0 .761(is used only when it')3.261 F 3.26(sn)-.55 G .76 +(ecessary to distinguish it from the historic)367.67 330 R(implementations of) +102 342 Q F2(ex/vi)2.5 E F0(.)A F1(ADDITION)72 366 Q 1.666(AL FEA)-.2 F(TURES) +-.95 E F0 .616(There are a fe)102 378 R 3.116(wf)-.25 G .616(eatures in)172.504 +378 R F2(nex/nvi)3.116 E F0 .616(that are not found in historic v)3.116 F .616 +(ersions of)-.15 F F2(ex/vi)3.116 E F0 3.116(.Al)C .616(ist of those fea-) +476.222 378 R(tures is as follo)102 390 Q(ws:)-.25 E(8-bit clean data, lar)102 +408 Q(ge lines, \214les)-.18 E F2(Nvi/nex)143 420 Q F0 .864(will edit an)3.364 +F 3.364(yf)-.15 G .864(ormat \214le.)246.636 420 R .863 +(Line lengths are limited by a)5.863 F -.25(va)-.2 G .863(ilable memory).25 F +3.363(,a)-.65 G .863(nd \214le sizes)491.054 420 R .511(are limited by a)143 +432 R -.25(va)-.2 G .511(ilable disk space.).25 F .512(The command `)5.511 F +(`^Vx[0-9A-F)-.74 E(a-f])-.15 E/F3 10/Symbol SF(*)A F0 -.74('')C 3.012(,i).74 G +3.012(ni)439.892 432 S .512(nput mode, will insert)450.684 432 R(an)143 444 Q +2.5(yl)-.15 G -2.25 -.15(eg a)162.57 444 T 2.5(lc).15 G(haracter v)185.97 444 Q +(alue into the te)-.25 E(xt.)-.15 E(Split screens)102 462 Q .036(The command `) +143 474 R .036(`:sp[lit] [\214le ...]')-.74 F 2.536('s)-.74 G .036 +(plits the screen in vi mode.)280.01 474 R .035(The k)5.035 F .335 -.15(ey `) +-.1 H(`^W')-.59 E 2.535('s)-.74 G .035(witches between the)458.84 474 R(fore) +143 486 Q .747(ground screens, and the `)-.15 F .747(`:resize count')-.74 F +3.247('c)-.74 G .747(ommand can be used to gro)329.952 486 R 3.248(wo)-.25 G +3.248(rs)459.166 486 S .748(hrink a particular)469.634 486 R(screen.)143 498 Q +(Background and fore)102 516 Q(ground screens)-.15 E .921(The command `)143 528 +R(`:bg')-.74 E 3.421('b)-.74 G .921 +(ackgrounds the current screen, and the command `)237.873 528 R .92 +(`:fg [\214le]')-.74 F 3.42('f)-.74 G(ore)495.16 528 Q(grounds)-.15 E .097 +(the backgrounded screen that is editing the speci\214ed \214le, or)143 540 R +2.597(,b)-.4 G 2.598(yd)391.31 540 S(ef)403.908 540 Q .098 +(ault, the \214rst background screen)-.1 F(on the queue.)143 552 Q +(The command `)5 E(`:di[splay] s[creens]')-.74 E 2.5('l)-.74 G +(ists the background screens.)355.63 552 Q(Shell screens)102 570 Q .128 +(The command `)143 582 R .128(`:sc[ript] [\214le ...]')-.74 F 2.628('r)-.74 G +.128(uns a shell in the screen.)284.9 582 R .127 +(Editing is unchanged, with the e)5.127 F(xcep-)-.15 E +(tion that a enters the current line \(stripped of an)143 594 +Q 2.5(yp)-.15 G(rompt\) as input to the shell.)418.78 594 Q -.8(Ta)102 612 S +2.5(gs).8 G(tacks)123.14 612 Q -.8(Ta)143 624 S .234(gs are no).8 F 2.734(wm) +-.25 G .234(aintained in a stack.)206.802 624 R .234(The command `)5.234 F +(`^T')-.74 E 2.734('r)-.74 G .235(eturns to the pre)379.97 624 R .235 +(vious tag location.)-.25 F(The)5.235 E .251(command `)143 636 R .251 +(`:tagpop [number)-.74 F(\214le]')7.168 E 2.751('r)-.74 G .251 +(eturns to the most recent tag location by def)293.021 636 R .251(ault, or)-.1 +F 2.75(,o)-.4 G(ptional-)508.89 636 Q .45(ly to a speci\214c tag number in the\ + tag stack, or the most recent tag from the speci\214ed \214le.)143 648 R .45 +(Use the)5.45 F .186(command `)143 660 R .186(`:di[splay] t[ags]')-.74 F 2.686 +('t)-.74 G 2.686(ov)266.218 660 S(ie)278.904 660 Q 2.686(wt)-.25 G .185 +(he tags stack.)298.56 660 R .185(The command `)5.185 F(`:tagtop')-.74 E 2.685 +('r)-.74 G .185(eturns to the top of)463.71 660 R(the tag stack.)143 672 Q(Ne) +102 690 Q 2.5(wd)-.25 G(isplays)128.13 690 Q 1.268(The command `)143 702 R +1.268(`:di[splay] b[uf)-.74 F 6.702(fers] s[creens] t[ags]')-.25 F 3.768('c) +-.74 G 1.269(an be used to display)379.666 702 R 3.769(,r)-.65 G(especti) +477.571 702 Q -.15(ve)-.25 G(ly).15 E 3.769(,t)-.65 G(he)530.56 702 Q 167.75 +(4.4BSD March)72 750 R(18, 1994)2.5 E(1)535 750 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F(current cut b)143 96 Q(uf)-.2 E +(fers, the backgrounded screens, and the tags stack.)-.25 E(In\214nite undo)102 +114 Q 1.052(The changes made during an edit session may be rolled backw)143 126 +R 1.051(ard and forw)-.1 F 3.551(ard. A)-.1 F('.)3.551 E 3.551('c)-.7 G(ommand) +505 126 Q .369(immediately after a 'u' command continues either forw)143 138 R +.369(ard or backw)-.1 F .37(ard depending on whether the)-.1 F('u' command w) +143 150 Q(as an undo or a redo.)-.1 E(Usage information)102 168 Q .412 +(The command `)143 180 R(`:e)-.74 E .412(xu[sage] [cmd]')-.15 F 2.912('a)-.74 G +.412(nd `)291.298 180 R .412(`viu[sage] [k)-.74 F -.15(ey)-.1 G(]').15 E 2.912 +('p)-.74 G(ro)384.934 180 Q .411(vide usage information for all of the)-.15 F +.3 -.15(ex a)143 192 T(nd vi commands by def).15 E(ault, or)-.1 E 2.5(,o)-.4 G +(ptionally)290.94 192 Q 2.5(,f)-.65 G(or a speci\214c command or k)334.18 192 Q +-.15(ey)-.1 G(.)-.5 E(Extended re)102 210 Q(gular e)-.15 E(xpressions)-.15 E +.811(The `)143 222 R .811(`:set e)-.74 F(xtended')-.15 E 3.311('c)-.74 G .812 +(ommand treats search and other command re)234.603 222 R .812(gular e)-.15 F +.812(xpressions as e)-.15 F(xtended)-.15 E(\(e)143 234 Q(grep\(1\) style\) re) +-.15 E(gular e)-.15 E(xpressions.)-.15 E -.8(Wo)102 252 S(rd search).8 E +(The command `)143 264 Q(`^A')-.74 E 2.5('s)-.74 G(earches for the w)231.77 264 +Q(ord referenced by the cursor)-.1 E(.)-.55 E(Number increment)102 282 Q +(The command `)143 294 Q(`#')-.74 E 2.5('i)-.74 G +(ncrements the number referenced by the cursor)225.11 294 Q(.)-.55 E(Pre)102 +312 Q(vious \214le)-.25 E(The command `)143 324 Q(`:pre)-.74 E(v[ious][!]')-.25 +E 2.5('e)-.74 G(dits the pre)275.39 324 Q(vious \214le from the ar)-.25 E +(gument list.)-.18 E(Left-Right scrolling)102 342 Q .734(The command `)143 354 +R .733(`:set leftright')-.74 F 3.233('m)-.74 G(ak)276.653 354 Q(es)-.1 E/F1 10 +/Courier-Bold@0 SF(nvi)3.233 E F0 .733 +(do left-right screen scrolling, instead of the traditional)3.233 F F1(vi)143 +366 Q F0(line wrapping.)2.5 E/F2 10/Times-Bold@0 SF(RECO)72 390 Q(VER)-.5 E(Y) +-.35 E F0 .128(There is no reco)102 402 R -.15(ve)-.15 G .128(ry program for) +.15 F F1(nvi)2.628 E F0 2.628(,n)C .128(or does)266.106 402 R F1(nvi)2.628 E F0 +.128(run setuid.)2.628 F .129(Users may reco)5.129 F -.15(ve)-.15 G 2.629(ra) +.15 G .429 -.15(ny \214)448.124 402 T .129(le which the).15 F 2.629(ym)-.15 G +(ay)530.56 402 Q(read, and the superuser may reco)102 414 Q -.15(ve)-.15 G 2.5 +(ra).15 G .3 -.15(ny e)253.03 414 T(dit session.).15 E 2.995 +(Edit sessions are back)102 432 R 2.994(ed by \214les in)-.1 F/F3 10/Courier@0 +SF(/var/tmp/vi.recover)5.494 E F0 5.494(,a)C 2.994(nd are named `)391.224 432 R +(`vi.XXXX')-.74 E 2.994(', where)-.74 F -.74(``)102 444 S(XXXX').74 E 3.104('i) +-.74 G 3.104(san)148.604 444 S .605(umber related to the process id.)168.142 +444 R .605 +(When a \214le is \214rst modi\214ed, a second \214le, which contains)5.605 F +.185(an email message for the user)102 456 R 2.685(,i)-.4 G 2.685(sc)229.07 456 +S .185(reated, and is named `)240.085 456 R(`reco)-.74 E -.15(ve)-.15 G -.55 +(r.).15 G(XXXX').55 E .185(', where, ag)-.74 F .185(ain, `)-.05 F(`XXXX')-.74 E +2.685('i)-.74 G 2.685(sa)505.655 456 S(ssoci-)516.67 456 Q .098 +(ated with the process id.)102 468 R .098(Both \214les are remo)5.098 F -.15 +(ve)-.15 G 2.599(da).15 G 2.599(tt)302.273 468 S .099 +(he end of a normal edit session, b)310.432 468 R .099 +(ut will remain if the ed-)-.2 F 2.248 +(it session is abnormally terminated or the user enters the e)102 480 R 2.248 +(x/vi `)-.15 F(`preserv)-.74 E(e')-.15 E 4.748('c)-.74 G 4.748(ommand. The) +431.578 480 R 2.248(use of the)4.748 F F3(/var/tmp)102 492 Q F0 +(directory may be changed setting the)2.5 E F2 -.18(re)2.5 G(cdir).18 E F0 +(option in the user')2.5 E 2.5(so)-.55 G 2.5(rs)414.78 492 S +(ystem startup information.)424.5 492 Q .143(The reco)102 510 R -.15(ve)-.15 G +.143(ry directory should ha).15 F .443 -.15(ve t)-.2 H .143(he `).15 F(`stick) +-.74 E(y-bit')-.15 E 2.643('s)-.74 G .143(et so that only the o)317.611 510 R +.144(wners of \214les may remo)-.25 F .444 -.15(ve t)-.15 H 2.644(hem. If).15 F +.106(this is not possible on the system, then a pseudo-user should o)102 522 R +.106(wn the reco)-.25 F -.15(ve)-.15 G .106(ry directory).15 F 5.106(.T)-.65 G +.105(he reco)467.35 522 R -.15(ve)-.15 G .105(ry direc-).15 F +(tory must be both read and write-able by an)102 534 Q 2.5(yu)-.15 G(ser)288.76 +534 Q(.)-.55 E .601(The reco)102 552 R -.15(ve)-.15 G .601(ry \214le has all o\ +f the necessary information in it to enable the user to reco).15 F -.15(ve)-.15 +G 3.101(rt).15 G .601(he edit session.)464.037 552 R(In)5.601 E .322 +(addition, it has all of the necessary email headers for sendmail.)102 564 R +.322(When the system is rebooted, all of the \214les)5.322 F(in)102 576 Q F3 +(/var/tmp/vi.recover)2.694 E F0 .194(named `)2.694 F(`reco)-.74 E -.15(ve)-.15 +G -.55(r.).15 G(XXXX').55 E 2.694('s)-.74 G .195 +(hould be sent by email, using the)337.456 576 R F14.361 E F0 .195 +(\215ag of send-)2.695 F .335 +(mail \(or a similar mechanism in other mailers\).)102 588 R 2.835(As)5.335 G +.335(imple w)311.935 588 R .335(ay to do this is to insert the follo)-.1 F .335 +(wing script into)-.25 F(your)102 600 Q F3(/etc/rc.local)2.5 E F0 +(\(or other startup\) \214le:)2.5 E F3 +(virecovery=`echo /var/tmp/vi.recover/recover.)132 612 Q/F4 10/Symbol SF(*)A F3 +(`)A(if [ "$virecovery" != "/var/tmp/vi.recover/recover.)132 624 Q F4(*)A F3 6 +("])C 6(;t)461 624 S(hen)479 624 Q(echo 'Recovering vi editor sessions')177 636 +Q(for i in $virecovery; do)177 648 Q(sendmail -t < $i)222 660 Q(done)177 672 Q +(fi)132 684 Q F0 167.75(4.4BSD March)72 750 R(18, 1994)2.5 E(2)535 750 Q EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F(If)102 96 Q/F1 10/Courier-Bold@0 SF(ex/vi)2.5 E F0(recei)2.5 +E -.15(ve)-.25 G 2.5(sah).15 G(angup \(SIGHUP\) signal, it will email the reco) +190.46 96 Q -.15(ve)-.15 G(ry information to the user itself.).15 E .773 +(If you don')102 114 R 3.273(th)-.18 G -2.25 -.2(av e)159.409 114 T .773 +(the sendmail program on your system, the source \214le)3.473 F/F2 10/Courier@0 +SF(nvi/recover.c)3.274 E F0 .774(will ha)3.274 F 1.074 -.15(ve t)-.2 H 3.274 +(ob).15 G(e)535.56 114 Q(modi\214ed to use your local mail deli)102 126 Q -.15 +(ve)-.25 G(ry programs.).15 E/F3 10/Times-Bold@0 SF(ST)72 150 Q(AR)-.9 E 1.666 +(TUP INFORMA)-.4 F(TION)-.95 E F1(Ex/vi)102 162 Q F0 .098(interprets one of tw) +2.598 F 2.598(op)-.1 G .098(ossible en)225.43 162 R .098(vironmental v)-.4 F +.098(ariables and reads up to three of \214v)-.25 F 2.597(ep)-.15 G .097 +(ossible \214les dur)473.896 162 R(-)-.2 E .695(ing startup.)102 174 R .695 +(The v)5.695 F .695(ariables and \214les are e)-.25 F .695(xpected to contain) +-.15 F F1(ex)3.195 E F0 .695(commands, not)3.195 F F1(vi)3.195 E F0 3.195 +(commands. In)3.195 F(addition,)3.195 E(the)102 186 Q 3.105(ya)-.15 G .605 +(re interpreted)126.615 186 R/F4 10/Times-Italic@0 SF(befor)3.105 E(e)-.37 E F0 +.604(the \214le to be edited is read, and therefore man)3.105 F(y)-.15 E F1(ex) +3.104 E F0 .604(commands may not be used.)3.104 F(Generally)102 198 Q 3.425(,a) +-.65 G 1.225 -.15(ny c)151.145 198 T .925(ommand that requires output to the s\ +creen or that needs a \214le upon which to operate, will).15 F +(cause an error if included in a startup \214le or en)102 210 Q(vironmental v) +-.4 E(ariable.)-.25 E 2.112(First, the \214le)102 228 R F2(/etc/vi.exrc)4.612 E +F0 2.112(is read.)4.612 F 2.112(Second, the en)7.112 F 2.111(vironmental v)-.4 +F(ariable)-.25 E F2(NEXINIT)4.611 E F0 2.111(\(or the v)4.611 F(ariable)-.25 E +F2(EXINIT)102 240 Q F0 4.085(,i)C(f)147.365 240 Q F2(NEXINIT)4.085 E F0(isn') +4.085 E 4.085(ts)-.18 G 1.585(et\) is interpreted.)226.44 240 R 1.586 +(Third, if neither)6.586 F F2(NEXINIT)4.086 E F0(or)4.086 E F2(EXINIT)4.086 E +F0 -.1(wa)4.086 G 4.086(ss).1 G 1.586(et, the \214le)497.108 240 R F2 +($HOME/.nexrc)102 252 Q F0 1.231(\(or the \214le)3.731 F F2($HOME/.exrc)3.731 E +F0 3.731(,i)C(f)300.595 252 Q F2($HOME/.nexrc)3.731 E F0(doesn')3.731 E 3.731 +(te)-.18 G 1.231(xist\) is read.)420.668 252 R -.15(Fo)6.23 G 1.23 +(urth, the \214le).15 F F2(.nexrc)102 264 Q F0(\(or the \214le)2.5 E F2(.exrc) +2.5 E F0 2.5(,i)C(f)222.44 264 Q F2(.nexrc)2.5 E F0(doesn')2.5 E 2.5(te)-.18 G +(xist\) is read.)302.82 264 Q .431(Startup \214les will not be read if the)102 +282 R 2.931(ya)-.15 G .431(re o)253.617 282 R .431(wned by an)-.25 F .431 +(yone other than the real user)-.15 F .431(-id of the user running)-.2 F F1(vi) +2.931 E F0(,)A .031(\(or by `)102 294 R(`root')-.74 E 2.531('i)-.74 G 2.531(nt) +161.983 294 S .031(he case of the \214le)172.294 294 R F2(/etc/vi.exrc)2.531 E +F0 2.531(\)o)C 2.531(ri)327.79 294 S 2.531(ft)336.431 294 S(he)345.072 294 Q +2.531(ya)-.15 G .031(re writable by an)366.333 294 R .031 +(yone other than the o)-.15 F(wner)-.25 E(.)-.55 E .725 +(Home directory startup \214les \(i.e.)102 306 R F2($HOME/.nexrc)5.725 E F0 +(and)3.225 E F2($HOME/.exrc)3.225 E F0 3.225(\)w)C .725 +(ill not be read if the `)413.27 306 R(`HOME')-.74 E(')-.74 E(en)102 318 Q .454 +(vironmental v)-.4 F .454(ariable is not set.)-.25 F .454 +(Local startup \214les \(i.e.)5.454 F F2(.nexrc)5.454 E F0(and)2.954 E F2 +(.exrc)2.954 E F0 2.954(\)w)C .454(ill not be read if the)438.038 318 R F3(exr) +2.953 E(c)-.18 E F0 .07(option is turned of)102 330 R 2.57(fi)-.25 G 2.57(nt) +184.25 330 S(he)194.6 330 Q F2(/etc/vi.exrc)2.57 E F0(,)A F2($HOME/.nexrc)2.57 +E F0 2.57(,o)C(r)365.75 330 Q F2($HOME/.exrc)2.57 E F0 .07(\214les, or in the) +2.57 F F2(NEXINIT)2.57 E F0(or)102 342 Q F2(EXINIT)2.888 E F0(en)2.887 E .387 +(vironmental v)-.4 F 2.887(ariables. It)-.25 F .387(is not an error for an) +2.887 F 2.887(yo)-.15 G 2.887(ft)361.688 342 S .387(he startup en)370.685 342 R +.387(vironmental v)-.4 F .387(ariables or \214les)-.25 F(not to e)102 354 Q +(xist.)-.15 E .711(Because the)102 372 R F1(ex)3.211 E F0 .712 +(command set supported by)3.211 F F1(nex/nvi)3.212 E F0 .712 +(is a superset of the command set supported by most)3.212 F .746 +(historical implementations of)102 384 R F1(ex)3.246 E F0(,)A F1(nex/nvi)3.246 +E F0 .746(can use the startup \214les created for the historical implementa-) +3.246 F(tions, b)102 396 Q(ut the con)-.2 E -.15(ve)-.4 G +(rse is often not true.).15 E F3 1.666(SIZING THE SCREEN)72 420 R F0 .325 +(The size of the screen can be set in a number of w)102 432 R(ays.)-.1 E F1 +(Ex/vi)5.326 E F0(tak)2.826 E .326(es the follo)-.1 F .326(wing steps until v) +-.25 F .326(alues are ob-)-.25 F(tained for both the number of ro)102 444 Q +(ws and number of columns in the screen.)-.25 E 10(1. If)102 468 R(the en)2.5 E +(vironmental v)-.4 E(ariable)-.25 E F2(LINES)2.5 E F0 -.15(ex)2.5 G +(ists, it is used to specify the number of ro).15 E(ws in the screen.)-.25 E 10 +(2. If)102 480 R 1.904(the en)4.404 F 1.903(vironmental v)-.4 F(ariable)-.25 E +F2(COLUMNS)4.403 E F0 -.15(ex)4.403 G 1.903 +(ists, it is used to specify the number of columns in the).15 F(screen.)122 492 +Q 10(3. The)102 504 R(TIOCGWINSZ)2.5 E F2(ioctl)2.5 E F0 +(\(2\) is attempted on the standard error \214le descriptor)A(.)-.55 E 10 +(4. The)102 516 R(termcap entry is check)2.5 E(ed for the `)-.1 E(`li')-.74 E +2.5('e)-.74 G(ntry \(ro)295.36 516 Q(ws\) and the `)-.25 E(`co')-.74 E 2.5('e) +-.74 G(ntry \(columns\).)402.2 516 Q 10(5. The)102 528 R(number of ro)2.5 E +(ws is set to 24, and the number of columns is set to 80.)-.25 E .021 +(If a windo)102 546 R 2.521(wc)-.25 G .021 +(hange size signal \(SIGWINCH\) is recei)157.073 546 R -.15(ve)-.25 G .022 +(d, the same steps are tak).15 F .022(en with the e)-.1 F .022 +(xception that the)-.15 F(\214rst tw)102 558 Q 2.5(os)-.1 G(teps are skipped.) +141.35 558 Q F3 1.666(REGULAR EXPRESSIONS AND REPLA)72 582 R 1.666 +(CEMENT STRINGS)-.55 F F0(Re)102 594 Q .105(gular e)-.15 F .105 +(xpressions are used in line addresses, as the \214rst part of)-.15 F F3 +(substitute)2.604 E F0(,)A F3(global)2.604 E F0 2.604(,a)C(nd)447.842 594 Q F3 +(vglobal)2.604 E F0(commands,)2.604 E(and in search patterns.)102 606 Q .323 +(The re)102 624 R .323(gular e)-.15 F .323(xpressions supported by)-.15 F F1 +(ex)2.824 E F0(and)2.824 E F1(vi)2.824 E F0 .324(are, by def)2.824 F .324 +(ault, the Basic Re)-.1 F .324(gular Expressions \(BRE')-.15 F .324(s\) de-) +-.55 F .102(scribed in the IEEE POSIX Standard 1003.2.)102 636 R(The)5.101 E F3 +(extended)2.601 E F0 .101(option causes all re)2.601 F .101(gular e)-.15 F .101 +(xpressions to be inter)-.15 F(-)-.2 E .517(preted as the Extended Re)102 648 R +.518(gular Expressions \(ERE')-.15 F .518(s\) described by the same standard.) +-.55 F(\(See)5.518 E F2(re_format)3.018 E F0(\(7\))A 1.615 +(for more information.)102 660 R 1.615(Generally speaking, BRE')6.615 F 4.115 +(sa)-.55 G(re)319.16 660 Q F2(ed)4.115 E F0 1.615(\(1\) and)B F2(grep)4.114 E +F0 1.614(\(1\) style re)B 1.614(gular e)-.15 F 1.614(xpressions, and)-.15 F +(ERE')102 672 Q 2.5(sa)-.55 G(re)134.5 672 Q F2(egrep)2.5 E F0(\(1\) style re)A +(gular e)-.15 E(xpressions.\))-.15 E 167.75(4.4BSD March)72 750 R(18, 1994)2.5 +E(3)535 750 Q EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F +(There are some special strings and characters that can be used in RE')102 96 Q +(s:)-.55 E 10(1. An)102 108 R(empty RE \(e.g.)2.5 E -.74(``)5 G(//').74 E +('\) is equi)-.74 E -.25(va)-.25 G(lent to the last RE used.).25 E 10(2. The) +102 120 R(construct `)2.5 E(`\\<')-.74 E 2.5('m)-.74 G(atches the be)209.75 120 +Q(ginning of a w)-.15 E(ord.)-.1 E 10(3. The)102 132 R(construct `)2.5 E(`\\>') +-.74 E 2.5('m)-.74 G(atches the end of a w)209.75 132 Q(ord.)-.1 E 10(4. The) +102 144 R(character `)2.5 E(`~')-.74 E 2.5('m)-.74 G +(atches the replacement part of the last)204.64 144 Q/F1 10/Times-Bold@0 SF +(substitute)2.5 E F0(command.)2.5 E .598(When the)102 162 R F1(magic)3.099 E F0 +.599(option is)3.099 F/F2 10/Times-Italic@0 SF(not)3.099 E F0 .599 +(set, the only characters with special meanings are `)3.099 F(`^')-.74 E 3.099 +('a)-.74 G 3.099(tt)454.984 162 S .599(he be)463.643 162 R .599(ginning of an) +-.15 F 1.09(RE, `)102 174 R(`$')-.74 E 3.59('a)-.74 G 3.59(tt)145.74 174 S 1.09 +(he end of an RE, and the escaping character `)154.89 174 R(`\\')-.74 E 1.089 +('. The characters `)-.74 F(`.')-.74 E 1.089(', `)-.74 F(`)-.74 E/F3 10/Symbol +SF(*)A F0 -.74('')C 3.589(,`).74 G(`[')472.333 174 Q 1.089(', and `)-.74 F(`~') +-.74 E 3.589('a)-.74 G(re)532.23 174 Q 1.05 +(treated as ordinary characters unless preceded by a `)102 186 R(`\\')-.74 E +1.05('; when preceded by a `)-.74 F(`\\')-.74 E 3.55('t)-.74 G(he)444.17 186 Q +3.55(yr)-.15 G -2.25 -.15(eg a)465.34 186 T 1.05(in their special).15 F +(meaning.)102 198 Q(Replacement strings are the second part of a)102 216 Q F1 +(substitute)2.5 E F0(command.)2.5 E 1.365(The character `)102 234 R(`&')-.74 E +3.865('\()-.74 G 1.365(or `)188.735 234 R(`\\&')-.74 E 3.864('i)-.74 G 3.864 +(ft)229.974 234 S(he)239.948 234 Q F1(magic)3.864 E F0 1.364(option is)3.864 F +F2(not)3.864 E F0 1.364(set\) in the replacement string stands for the te)3.864 +F(xt)-.15 E .713(matched by the RE that')102 246 R 3.213(sb)-.55 G .713 +(eing replaced.)213.615 246 R .714(The character `)5.714 F(`~')-.74 E 3.214 +('\()-.74 G .714(or `)356.464 246 R(`\\~')-.74 E 3.214('i)-.74 G 3.214(ft) +391.952 246 S(he)401.276 246 Q F1(magic)3.214 E F0 .714(option is)3.214 F F2 +(not)3.214 E F0 .714(set\) stands)3.214 F(for the replacement part of the pre) +102 258 Q(vious)-.25 E F1(substitute)2.5 E F0(command.)2.5 E .325(The string `) +102 276 R(`\\#')-.74 E .325(', where `)-.74 F(`#')-.74 E 2.825('i)-.74 G 2.825 +(sa)220.625 276 S 2.825(ni)231.78 276 S(nte)242.385 276 Q .325(ger v)-.15 F +.325(alue from 1 to 9, stands for the te)-.25 F .325 +(xt matched by the portion of the)-.15 F 1.239(RE enclosed in the #')102 288 R +1.239(th set of escaped parentheses, e.g.)-.18 F -.74(``)6.239 G(\\\(').74 E +3.74('a)-.74 G 1.24(nd `)366.4 288 R(`\\\)')-.74 E 1.24('. F)-.74 F 1.24(or e) +-.15 F 1.24(xample, `)-.15 F(`s/abc\\\(.)-.74 E F3(*)A F0(\\\)def/\\1/')A(') +-.74 E(deletes the strings `)102 300 Q(`abc')-.74 E 2.5('a)-.74 G(nd `)208.82 +300 Q(`def')-.74 E 2.5('f)-.74 G(rom the matched pattern.)251.76 300 Q .052 +(The strings `)102 318 R(`\\l')-.74 E .051(', `)-.74 F(`\\u')-.74 E .051(', `) +-.74 F(`\\L')-.74 E .051(', and `)-.74 F(`\\U')-.74 E 2.551('c)-.74 G .051 +(an be used to modify the case of elements in the replacement string.)268.048 +318 R .287(The string `)102 330 R(`\\l')-.74 E 2.787('c)-.74 G .287 +(auses the ne)170.531 330 R .287(xt character to be con)-.15 F -.15(ve)-.4 G +.287(rted to lo).15 F .287(wercase; the string `)-.25 F(`\\u')-.74 E 2.787('b) +-.74 G(eha)457.575 330 Q -.15(ve)-.2 G 2.787(ss).15 G(imilarly)491.112 330 Q +2.788(,b)-.65 G(ut)532.22 330 Q(con)102 342 Q -.15(ve)-.4 G .449 +(rts to uppercase.).15 F .449(The strings `)5.449 F(`\\L')-.74 E 2.949('c)-.74 +G .449(auses characters up to the end of the string or the ne)273.174 342 R +.448(xt occurrence)-.15 F .637(of the strings `)102 354 R(`\\e')-.74 E 3.137 +('o)-.74 G 3.137(r`)185.828 354 S(`\\E')194.885 354 Q 3.137('t)-.74 G 3.137(ob) +218.942 354 S 3.137(ec)232.079 354 S(on)244.096 354 Q -.15(ve)-.4 G .637 +(rted to lo).15 F .637(wercase; the string `)-.25 F(`\\U')-.74 E 3.137('b)-.74 +G(eha)409.488 354 Q -.15(ve)-.2 G 3.138(ss).15 G(imilarly)443.376 354 Q 3.138 +(,b)-.65 G .638(ut con)484.834 354 R -.15(ve)-.4 G .638(rts to).15 F +(uppercase.)102 366 Q(In)102 384 Q/F4 10/Courier-Bold@0 SF(vi)3.372 E F0 3.372 +(,i)C .872(nserting a into the replacement string will cause the m\ +atched line to be split into tw)134.354 384 R(o)-.1 E(lines at that point.)102 +396 Q F1 1.666(SET OPTIONS)72 420 R F0 .518(There are a lar)102 432 R .518 +(ge number of options that may be set \(or unset\) to change the editor')-.18 F +3.019(sb)-.55 G(eha)453.612 432 Q(vior)-.2 E 5.519(.T)-.55 G .519(his section) +496.981 432 R(describes the options, their abbre)102 444 Q +(viations and their def)-.25 E(ault v)-.1 E(alues.)-.25 E .095 +(In each entry belo)102 462 R 1.395 -.65(w, t)-.25 H .095 +(he \214rst part of the tag line is the full name of the option, follo).65 F +.095(wed by an)-.25 F 2.595(ye)-.15 G(qui)487.915 462 Q -.25(va)-.25 G .095 +(lent ab-).25 F(bre)102 474 Q 2.973(viations. \(Re)-.25 F -.05(ga)-.15 G .473 +(rdless of the abbre).05 F .473 +(viations, it is only necessary to use the minimum number of characters)-.25 F +.164(necessary to distinguish an abbre)102 486 R .164 +(viation from all other commands for it to be accepted, in)-.25 F F4(nex/nvi) +2.663 E F0 2.663(.H)C(istor)519.09 486 Q(-)-.2 E(ically)102 498 Q 3.156(,o)-.65 +G .656(nly the full name and the of)134.226 498 R .656(\214cial abbre)-.25 F +.657(viations were accepted by)-.25 F F4(ex/vi)3.157 E F0 3.157(.U)C .657 +(sing full names in your)445.152 498 R .274(startup \214les and en)102 510 R +.274(vironmental v)-.4 F .274(ariables will probably mak)-.25 F 2.774(et)-.1 G +.274(hem more portable.\))351.192 510 R .274(The part in square brack-)5.274 F +.678(ets is the def)102 522 R .678(ault v)-.1 F .678(alue of the option.)-.25 F +.679(Most of the options are boolean, i.e. the)5.678 F 3.179(ya)-.15 G .679 +(re either on or of)433.706 522 R .679(f, and do)-.25 F(not ha)102 534 Q .3 +-.15(ve a)-.2 H 2.5(na).15 G(ssociated v)154.69 534 Q(alue.)-.25 E +(Options apply to both)102 552 Q F4(ex)2.5 E F0(and)2.5 E F4(vi)2.5 E F0 +(modes, unless otherwise speci\214ed.)2.5 E -.15(Fo)102 570 S 3.542(ri).15 G +1.041(nformation on modifying the options or to display the options and their \ +current v)122.062 570 R 1.041(alues, see the `)-.25 F(`set')-.74 E(')-.74 E +(command in the Ex Commands section.)102 582 Q/F5 10/Courier@0 SF +(altwerase [off])102 594 Q F4(Vi)131 606 Q F0(only)3.119 E 5.619(.C)-.65 G .619 +(hange ho)178.038 606 R(w)-.25 E F4(vi)3.119 E F0 .619(does w)3.119 F .619 +(ord erase during te)-.1 F .619(xt input.)-.15 F .62 +(When this option is set, te)5.62 F .62(xt is brok)-.15 F(en)-.1 E .552(up int\ +o three classes: alphabetic, numeric and underscore characters, other non-blan\ +k characters, and)131 618 R .245(blank characters.)131 630 R .246 +(Changing from one class to another marks the end of a w)5.245 F 2.746(ord. In) +-.1 F .246(addition, the class)2.746 F .411 +(of the \214rst character erased is ignored \(which is e)131 642 R .41 +(xactly what you w)-.15 F .41(ant when erasing pathname com-)-.1 F(ponents\).) +131 654 Q F5(autoindent, ai [off])102 666 Q F0 .317 +(If this option is set, whene)131 678 R -.15(ve)-.25 G 2.817(ry).15 G .317 +(ou create a ne)258.322 678 R 2.818(wl)-.25 G .318(ine \(using the)327.092 678 +R F4(vi)2.818 E F1(A)2.818 E F0(,)A F1(a)2.818 E F0(,)A F1(C)2.818 E F0(,)A F1 +(c)2.818 E F0(,)A F1(I)2.818 E F0(,)A F1(i)2.818 E F0(,)A F1(O)2.818 E F0(,)A +F1(o)2.818 E F0(,)A F1(R)2.818 E F0(,)A F1(r)2.818 E F0(,)A F1(S)2.818 E F0 +2.818(,a)C(nd)523.292 678 Q F1(s)2.818 E F0 .302(commands, or the)131 690 R F4 +(ex)2.802 E F1(append)2.802 E F0(,)A F1(change)2.802 E F0 2.802(,a)C(nd)297.312 +690 Q F1(insert)2.801 E F0 .301(commands\) the ne)2.801 F 2.801(wl)-.25 G .301 +(ine is automatically indented)423.827 690 R .443(to align the cursor with the\ + \214rst non-blank character of the line from which you created it.)131 702 R +.443(Lines are)5.443 F 167.75(4.4BSD March)72 750 R(18, 1994)2.5 E(4)535 750 Q +EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F 1.112(indented using tab characters to the e)131 96 R 1.112 +(xtent possible \(based on the v)-.15 F 1.112(alue of the)-.25 F/F1 10 +/Times-Bold@0 SF(tabstop)3.612 E F0 1.111(option\) and)3.611 F .548 +(then using space characters as necessary)131 108 R 5.549(.F)-.65 G .549 +(or commands inserting te)307.88 108 R .549(xt into the middle of a line, an) +-.15 F(y)-.15 E .47(blank characters to the right of the cursor are discarded,\ + and the \214rst non-blank character to the right)131 120 R +(of the cursor is aligned as described abo)131 132 Q -.15(ve)-.15 G(.).15 E +.874(The indent characters are themselv)131 150 R .874(es some)-.15 F .875 +(what special.)-.25 F .875(If you do not enter more characters on the)5.875 F +(ne)131 162 Q 3.705(wl)-.25 G 1.205(ine before mo)153.895 162 R 1.205(ving mo) +-.15 F 1.205 +(ving to another line, or entering , the indent character will be)-.15 +F .676(deleted and the line will be empty)131 174 R 5.676(.F)-.65 G .676(or e) +283.532 174 R .676(xample, if you enter twice in succession,) +-.15 F .73(the line created by the \214rst will not ha)131 +186 R 1.03 -.15(ve a)-.2 H 1.03 -.15(ny c).15 H .73(haracters in it, re).15 F +-.05(ga)-.15 G .73(rdless of the in-).05 F(dentation of the pre)131 198 Q +(vious or subsequent line.)-.25 E .414(Indent characters also require that you\ + enter additional erase characters to delete them.)131 216 R -.15(Fo)5.415 G +2.915(re).15 G(xample,)508.06 216 Q .754(if you ha)131 228 R 1.054 -.15(ve a) +-.2 H 3.254(ni).15 G .753(ndented line, containing only blanks, the \214rst character you enter will)-.1 F .676(erase up to \ +end of the indent characters, and the second will erase back to the be)131 240 +R .677(ginning of the line.)-.15 F(\(Historically)131 252 Q 2.88(,o)-.65 G .38 +(nly the)191.28 252 R F1(^D)2.88 E F0 -.1(ke)2.88 G 2.88(yw)-.05 G .38 +(ould erase the indent characters.)259.66 252 R .379(Both the)5.379 F F1(^D) +2.879 E F0 -.1(ke)2.879 G 2.879(ya)-.05 G .379(nd the usual erase)467.493 252 R +-.1(ke)131 264 S .617(ys w)-.05 F .617(ork in)-.1 F/F2 10/Courier-Bold@0 SF +.618(nvi .\))3.118 F F0 .618(In addition, if the cursor is positioned at the e\ +nd of the indent characters, the)3.118 F -.1(ke)131 276 S .04(ys `)-.05 F +(`0^D')-.74 E 2.54('w)-.74 G .039(ill erase all of the indent characters for t\ +he current line, resetting the indentation le)188.77 276 R -.15(ve)-.25 G 2.539 +(lt).15 G(o)535 276 Q 2.736(0. Similarly)131 288 R 2.736(,t)-.65 G .236(he k) +188.332 288 R -.15(ey)-.1 G 2.736(s`).15 G(`^^D')223.914 288 Q 2.736('\()-.74 G +.237(i.e. a carat follo)253.11 288 R .237 +(wed by a \) will erase all of the indent char)-.25 F(-)-.2 E +(acters for the current line, lea)131 300 Q(ving the indentation le)-.2 E -.15 +(ve)-.25 G 2.5(lf).15 G(or future created lines unaf)355.35 300 Q(fected.)-.25 +E(Finally)131 318 Q 2.644(,i)-.65 G(f)166.614 318 Q F1(autoindent)2.644 E F0 +.144(is set, the)2.644 F F1(S)2.644 E F0(and)2.644 E F1(cc)2.644 E F0 .143 +(commands change from the \214rst non-blank of the line to the)2.644 F +(end of the line, instead of from the be)131 330 Q +(ginning of the line to the end of the line.)-.15 E/F3 10/Courier@0 SF +(autoprint, ap [off])102 342 Q F2(Ex)131 354 Q F0(only)2.852 E(.)-.65 E F2(Ex) +5.353 E F0(only)2.853 E 5.353(.C)-.65 G .353 +(ause the current line to be automatically displayed after the)217.341 354 R F2 +(ex)2.853 E F0(commands)2.853 E F1(<)2.853 E F0(,)A F1(>)2.853 E F0(,)A F1 +(copy)131 366 Q F0(,)A F1(delete)2.576 E F0(,)A F1(join)2.576 E F0(,)A F1(mo) +2.576 E -.1(ve)-.1 G F0(,).1 E F1(put)2.576 E F0(,)A F1(t)2.576 E F0(,)A F1 +(Undo)2.576 E F0 2.576(,a)C(nd)296.322 366 Q F1(undo)2.576 E F0 2.576(.T)C .076 +(his automatic display is suppressed during)341.764 366 R F1(global)2.576 E F0 +(and)131 378 Q F1(vglobal)2.974 E F0 .474(commands, and for an)2.974 F 2.975 +(yc)-.15 G .475(ommand where optional \215ags are used to e)285.065 378 R .475 +(xplicitly display the)-.15 F(line.)131 390 Q F3(autowrite, aw [off])102 402 Q +F0 .663(If this option is set, the)131 414 R F2(vi)3.163 E F1 3.163(!^)3.163 G +3.163(^^)254.134 414 S(])263.957 414 Q F0(and)3.163 E F1(^Z)3.162 E F0 .662 +(commands, and the)3.162 F F2(ex)3.162 E F1(edit)3.162 E F0(,)A F1(next)3.162 E +F0(,)A F1 -.18(re)3.162 G(wind).18 E F0(,)A F1(stop)3.162 E F0(,)A F1(suspend) +3.162 E F0(,)A F1(tag)131 426 Q F0(,)A F1(tagpop)2.51 E F0 2.51(,a)C(nd)188.24 +426 Q F1(tagtop)2.51 E F0 .011(commands automatically write the current \214le\ + back to the current \214le name if)2.51 F .737 +(it has been modi\214ed since it w)131 438 R .737(as last written.)-.1 F .737 +(If the write f)5.737 F .737(ails, the command f)-.1 F .736 +(ails and goes no fur)-.1 F(-)-.2 E(ther)131 450 Q(.)-.55 E 2.307 +(Appending the optional force \215ag `)131 468 R(`!')-.74 E 4.807('t)-.74 G +4.807(ot)302.772 468 S(he)315.359 468 Q F2(ex)4.807 E F0(commands)4.807 E F1 +(next)4.807 E F0(,)A F1 -.18(re)4.807 G(wind).18 E F0(,)A F1(stop)4.807 E F0(,) +A F1(suspend)4.808 E F0(,)A F1(tag)4.808 E F0(,)A F1(tagpop)131 480 Q F0 2.5 +(,a)C(nd)169.89 480 Q F1(tagtop)2.5 E F0 +(stops the automatic write from being attempted.)2.5 E(\(Historically)131 498 Q +2.812(,t)-.65 G(he)188.992 498 Q F1(next)2.812 E F0 .312 +(command ignored the optional force \215ag.\))2.812 F .311(Note, the)5.311 F F2 +(ex)2.811 E F0(commands)2.811 E F1(edit)2.811 E F0(,)A F1(quit)2.811 E F0(,)A +F1(shell)131 510 Q F0 2.5(,a)C(nd)159.89 510 Q F1(xit)2.5 E F0(are)2.5 E/F4 10 +/Times-Italic@0 SF(not)2.5 E F0(af)2.5 E(fected by the)-.25 E F1(auto)2.5 E +(write)-.1 E F0(option.)2.5 E F3(beautify, bf [off])102 522 Q F0 .359(If this \ +option is set, all control characters that are not currently being specially i\ +nterpreted, other than)131 534 R 1.38(, , and , are discarded from commands read in by)-.25 F F2(ex) +3.88 E F0 1.38(from command)3.88 F .51(\214les, and from input te)131 558 R .51 +(xt entered to)-.15 F F2(vi)3.01 E F0 .511 +(\(either into the \214le or to the colon command line\).)3.01 F -1.25 -.7 +(Te x)5.511 H 3.011<748c>.7 G(les)528.89 558 Q(read by)131 570 Q F2(ex/vi)2.5 E +F0(are)2.5 E F4(not)2.5 E F0(af)2.5 E(fected by the)-.25 E F1(beautify)2.5 E F0 +(option.)2.5 E F3(cdpath [environment variable CDPATH, or ``.''])102 582 Q F0 +.451(This option is used to specify a colon separated list of directories whic\ +h are used as path pre\214x)131 594 R .45(es for)-.15 F(an)131 606 Q 3.014(yr) +-.15 G(elati)151.634 606 Q .814 -.15(ve p)-.25 H .514(ath names used as ar).15 +F .515(guments for the)-.18 F F1(cd)3.015 E F0 3.015(command. The)3.015 F -.25 +(va)3.015 G .515(lue of this option def).25 F .515(aults to)-.1 F 1.01(the v) +131 618 R 1.01(alue of the en)-.25 F 1.01(vironmental v)-.4 F(ariable)-.25 E F3 +(CDPATH)3.51 E F0 1.009(if it is set, otherwise to the current directory)3.509 +F 6.009(.F)-.65 G(or)531.67 618 Q .148 +(compatibility with the POSIX 1003.2 shell, the)131 630 R F1(cd)2.649 E F0 .149 +(command does)2.649 F F4(not)2.649 E F0 .149(check the current directory as a) +2.649 F .385(path pre\214x for relati)131 642 R .685 -.15(ve p)-.25 H .385 +(ath names unless it is e).15 F .385(xplicitly speci\214ed.)-.15 F .384 +(It may be so speci\214ed by entering)5.385 F(an empty string or a `)131 654 Q +(`.')-.74 E 2.5('i)-.74 G(nto the)233.11 654 Q F3(CDPATH)2.5 E F0 -.25(va)2.5 G +(riable or the option v).25 E(alue.)-.25 E F3(columns, co [80])102 666 Q F0 +.278(The number of columns in the screen.)131 678 R .278 +(Setting this option causes)5.278 F F2(ex/vi)2.778 E F0 .279 +(to set \(or reset\) the en)2.778 F(viron-)-.4 E 167.75(4.4BSD March)72 750 R +(18, 1994)2.5 E(5)535 750 Q EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F(mental v)131 96 Q(ariable)-.25 E/F1 10/Courier@0 SF(COLUMNS) +2.5 E F0 2.5(.S)C(ee the SCREEN SIZING section for more information.)247.74 96 +Q F1(comment [off])102 108 Q/F2 10/Courier-Bold@0 SF(Vi)131 120 Q F0(only)3.265 +E 5.765(.I)-.65 G 3.265(ft)174.99 120 S .764 +(he \214rst non-empty line of the \214le be)184.365 120 R .764 +(gins with the string `)-.15 F(`/)-.74 E/F3 10/Symbol SF(*)A F0 -.74('')C 3.264 +(,t).74 G .764(his option causes)443.834 120 R F2(vi)3.264 E F0(to)3.264 E +(skip to the end of that C comment \(probably a terribly boring le)131 132 Q +-.05(ga)-.15 G 2.5(ln).05 G(otice\) before displaying the \214le.)404.94 132 Q +F1(directory, dir [environment variable TMPDIR, or /tmp])102 144 Q F0 .545 +(The directory where temporary \214les are created.)131 156 R .546(The en)5.546 +F .546(vironmental v)-.4 F(ariable)-.25 E F1(TMPDIR)3.046 E F0 .546 +(is used as the)3.046 F(def)131 168 Q(ault v)-.1 E(alue if it e)-.25 E +(xists, otherwise)-.15 E F1(/tmp)2.5 E F0(is used.)2.5 E F1 +(edcompatible, ed [off])102 180 Q F0 .214 +(This option causes the presence or absence of)131 192 R/F4 10/Times-Bold@0 SF +(g)2.714 E F0(and)2.714 E F4(c)2.714 E F0(suf)2.714 E<8c78>-.25 E .214(es on) +-.15 F F4(substitute)2.714 E F0 .214(commands to be remem-)2.714 F .654 +(bered, and to be toggled by repeating the suf)131 204 R 3.154(\214ces. The) +-.25 F(suf)3.154 E<8c78>-.25 E F4(r)3.154 E F0(mak)3.154 E .654 +(es the substitution be as in the)-.1 F F4(~)3.155 E F0 +(command, instead of lik)131 216 Q 2.5(et)-.1 G(he)237.28 216 Q F4(&)2.5 E F0 +(command.)2.5 E/F5 10/Times-Italic@0 SF(This option is not yet implemented.)131 +228 Q F1(errorbells, eb [off])102 240 Q F2(Ex)131 252 Q F0(only)2.5 E 5(.C)-.65 +G(auses)176.8 252 Q F2(ex)2.5 E F0(error messages to be preceded by a bell.)2.5 +E F5(This option is not yet implemented.)131 264 Q F1(exrc, ex [off])102 276 Q +F0 .394(If this option is turned of)131 288 R 2.894(fi)-.25 G 2.894(nt)241.444 +288 S .394 +(he system or $HOME startup \214les, the local startup \214les are ne)252.118 +288 R -.15(ve)-.25 G 2.893(rr).15 G(ead)526.12 288 Q .404(\(unless the)131 300 +R 2.904(ya)-.15 G .405(re the same as the system or $HOME startup \214les\).) +186.648 300 R -.45(Tu)5.405 G .405(rning it on has no ef).45 F .405 +(fect, i.e. the)-.25 F .693 +(normal checks for local startup \214les are performed, re)131 312 R -.05(ga) +-.15 G 3.192(rdless. See).05 F .692(the ST)3.192 F(AR)-.93 E .692(TUP INFORMA) +-.6 F(TION)-1.11 E(section for more information.)131 324 Q F1(extended [off]) +102 336 Q F0 .007(This option causes all re)131 348 R .007(gular e)-.15 F .007 +(xpressions to be treated as POSIX 1003.2 e)-.15 F .008(xtended re)-.15 F .008 +(gular e)-.15 F(xpressions)-.15 E(\(which are similar to historic)131 360 Q F1 +(egrep)2.5 E F0(\(1\) style e)A(xpressions\).)-.15 E F1(flash [on])102 372 Q F0 +.077(This option causes the screen to \215ash instead of beeping the k)131 384 +R -.15(ey)-.1 G .077(board, on error).15 F 2.577(,i)-.4 G 2.577(ft)455.262 384 +S .077(he terminal has the)463.949 384 R(capability)131 396 Q(.)-.65 E F1 +(hardtabs, ht [8])102 408 Q F0 .269 +(This option de\214nes the spacing between hardw)131 420 R .269 +(are tab settings, i.e.)-.1 F .27(the tab e)5.269 F .27 +(xpansion done by the op-)-.15 F .577 +(erating system and/or the terminal itself.)131 432 R(As)5.577 E F2(nex/nvi) +3.077 E F0(ne)3.077 E -.15(ve)-.25 G 3.077(rw).15 G .576 +(rites tabs to the terminal, unlik)392.483 432 R 3.076(eh)-.1 G(is-)530 432 Q +(toric v)131 444 Q(ersions of)-.15 E F2(ex/vi)2.5 E F0 2.5(,t)C +(his option does not currently ha)236.12 444 Q .3 -.15(ve a)-.2 H .3 -.15(ny a) +.15 H -.25(ff).15 G(ect.).25 E F1(ignorecase, ic [off])102 456 Q F0 .977 +(This option causes re)131 468 R .977(gular e)-.15 F .977(xpressions, both in) +-.15 F F2(ex)3.477 E F0 .978(commands and in searches, to be e)3.477 F -.25(va) +-.25 G .978(luated in a).25 F(case-insensiti)131 480 Q .3 -.15(ve m)-.25 H +(anner).15 E(.)-.55 E F1(keytime [6])102 492 Q F0(The 10th')131 504 Q 2.5(so) +-.55 G 2.5(fas)181 504 S(econd)197.66 504 Q F2(ex/vi)2.5 E F0 -.1(wa)2.5 G +(its for a subsequent k).1 E .3 -.15(ey t)-.1 H 2.5(oc).15 G(omplete a k)379.5 +504 Q .3 -.15(ey m)-.1 H(apping.).15 E F1(leftright [off])102 516 Q F2(Vi)131 +528 Q F0(only)3.198 E 5.697(.T)-.65 G .697 +(his option causes the screen to be scrolled left-right to vie)177.635 528 R +3.197(wl)-.25 G .697(ines longer than the screen,)428.072 528 R .98 +(instead of the traditional)131 540 R F2(vi)3.48 E F0 .98(screen interf)3.48 F +.98(ace which folds long lines at the right-hand mar)-.1 F .98(gin of the)-.18 +F(terminal.)131 552 Q F1(lines, li [24])102 564 Q F2(Vi)131 576 Q F0(only)2.569 +E 5.069(.T)-.65 G .069(he number of lines in the screen.)176.378 576 R .069 +(Setting this option causes)5.069 F F2(ex/vi)2.569 E F0 .069 +(to set \(or reset\) the en-)2.569 F(vironmental v)131 588 Q(ariable)-.25 E F1 +(LINES)2.5 E F0 2.5(.S)C(ee the Screen Sizing section for more information.) +256.85 588 Q F1(lisp [off])102 600 Q F2(Vi)131 612 Q F0(only)2.948 E 5.448(.T) +-.65 G .448(his option changes the beha)177.136 612 R .448(vior of the)-.2 F F2 +(vi)2.948 E F4(\()2.948 E F0(,)A F4(\))2.948 E F0(,)A F4({)2.948 E F0(,)A F4(}) +2.948 E F0(,)A F4([[)2.948 E F0(and)2.948 E F4(]])2.948 E F0 .448 +(commands to match the Lisp)2.948 F 2.5(language. Also,)131 624 R(the)2.5 E F4 +(autoindent)2.5 E F0(option')2.5 E 2.5(sb)-.55 G(eha)301.56 624 Q +(vior is changed to be appropriate for Lisp.)-.2 E F5 +(This option is not yet implemented.)131 636 Q F1(list [off])102 648 Q F0 .639 +(This option causes lines to be displayed in an unambiguous f)131 660 R 3.139 +(ashion. Speci\214cally)-.1 F 3.139(,t)-.65 G .639(abs are displayed)469.852 +660 R(as control characters, i.e.)131 672 Q -.74(``)5 G(^I').74 E +(', and the ends of lines are mark)-.74 E(ed with a `)-.1 E(`$')-.74 E 2.5('c) +-.74 G(haracter)441.72 672 Q(.)-.55 E F1(magic [on])102 684 Q F0 .992 +(This option is on by def)131 696 R 3.493(ault. T)-.1 F .993(urning the)-.45 F +F4(magic)3.493 E F0 .993(option of)3.493 F 3.493(fc)-.25 G .993(auses all re) +383.048 696 R .993(gular e)-.15 F .993(xpression characters)-.15 F -.15(ex)131 +708 S 1.235(cept for `).15 F(`^')-.74 E 3.735('a)-.74 G 1.235(nd `)199.425 708 +R(`$')-.74 E 1.235(', to be treated as ordinary characters.)-.74 F 2.835 -.8 +(To r)6.235 H 1.235(e-enable characters indi).8 F(vidually)-.25 E(,)-.65 E +167.75(4.4BSD March)72 756 R(18, 1994)2.5 E(6)535 756 Q EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F .589(when the)131 96 R/F1 10/Times-Bold@0 SF(magic)3.089 E F0 +.589(option is of)3.089 F .589(f, precede them with an `)-.25 F(`\\')-.74 E .59 +('. See the REGULAR EXPRESSIONS AND)-.74 F(REPLA)131 108 Q +(CEMENT STRINGS section for more information.)-.4 E/F2 10/Courier@0 SF +(matchtime [7])102 120 Q/F3 10/Courier-Bold@0 SF(Vi)131 132 Q F0(only)2.885 E +5.385(.T)-.65 G .385(he 10th')177.01 132 R 2.885(so)-.55 G 2.885(fas)221.67 132 +S(econd)239.1 132 Q F3(ex/vi)2.884 E F0 .384 +(pauses on the matching character when the)2.884 F F1(sho)2.884 E(wmatch)-.1 E +F0(op-)2.884 E(tion is set.)131 144 Q F2(mesg [on])102 156 Q F0 .944 +(This option allo)131 168 R .944(ws other users to contact you using the)-.25 F +F2(talk)3.444 E F0 .944(\(1\) and)B F2(write)3.444 E F0 .944 +(\(1\) utilities, while you)B .751(are editing.)131 180 R F3(Ex/vi)5.751 E F0 +.751(does not turn message on, i.e. if messages were turned of)3.251 F 3.25(fw) +-.25 G .75(hen the editor w)464.81 180 R(as)-.1 E(in)131 192 Q -.2(vo)-.4 G -.1 +(ke).2 G .12(d, the).1 F 2.62(yw)-.15 G .12(ill stay turned of)194.55 192 R +2.62(f. This)-.25 F .12(option only permits you to disallo)2.62 F 2.62(wm)-.25 +G .12(essages for the edit ses-)445.1 192 R 2.5(sion. See)131 204 R(the)2.5 E +F2(mesg)2.5 E F0(\(1\) utility for more information.)A F2 +(modelines, modeline [off])102 216 Q F0 .372(If the)131 228 R F1(modelines) +2.872 E F0 .371(option is set,)2.871 F F3(ex/vi)2.871 E F0 .371 +(has historically scanned the \214rst and last \214v)2.871 F 2.871(el)-.15 G +.371(ines of each \214le)475.847 228 R .281 +(as it is read for editing, looking for an)131 240 R(y)-.15 E F3(ex)2.781 E F0 +.281(commands that ha)2.781 F .581 -.15(ve b)-.2 H .281 +(een placed in those lines.).15 F .282(After the)5.281 F .3(startup informatio\ +n has been processed, and before the user starts editing the \214le, an)131 252 +R 2.8(yc)-.15 G .3(ommands em-)482.76 252 R .029(bedded in the \214le are e)131 +264 R -.15(xe)-.15 G 2.529(cuted. Commands).15 F .029 +(are recognized by the letters `)2.529 F(`e')-.74 E 2.53('o)-.74 G 2.53(r`) +447.57 264 S(`v')456.02 264 Q 2.53('f)-.74 G(ollo)476.13 264 Q .03(wed by `) +-.25 F(`x')-.74 E(')-.74 E .398(or `)131 276 R(`i')-.74 E .398(', at the be) +-.74 F .397(ginning of a line or follo)-.15 F .397 +(wing a tab or space character)-.25 F 2.897(,a)-.4 G .397(nd follo)424.318 276 +R .397(wed by a `)-.25 F(`:')-.74 E .397(', an)-.74 F F3(ex)2.897 E F0 .108 +(command, and another `)131 288 R(`:')-.74 E .109 +('. This option is a security problem of immense proportions, and should not) +-.74 F(be used under an)131 300 Q 2.5(yc)-.15 G(ircumstances.)210.27 300 Q/F4 +10/Times-Italic@0 SF(This option will ne)131 312 Q(ver be implemented.)-.15 E +F2(number, nu [off])102 324 Q F0 +(Precede each line displayed with its current line number)131 336 Q(.)-.55 E F2 +(open [on])102 348 Q F3(Ex)131 360 Q F0(only)2.5 E 5(.I)-.65 G 2.5(ft)173.46 +360 S(his option is not set, the)182.07 360 Q F1(open)2.5 E F0(and)2.5 E F1 +(visual)2.5 E F0(commands are disallo)2.5 E(wed.)-.25 E F2(optimize, opt [on]) +102 372 Q F3(Vi)131 384 Q F0(only)3.104 E 5.604(.T)-.65 G .604(hroughput of te) +177.448 384 R .604(xt is e)-.15 F .604 +(xpedited by setting the terminal to no do automatic carriage returns)-.15 F +.084(when printing more than one \(logical\) line of output, greatly speeding \ +output on terminals without ad-)131 396 R(dressable cursors when te)131 408 Q +(xt with leading white space is printed.)-.15 E F4 +(This option is not yet implemented.)131 420 Q F2 +(paragraphs, para [IPLPPPQPP LIpplpipbp])102 432 Q F3(Vi)131 444 Q F0(only) +2.783 E 5.283(.D)-.65 G .283(e\214ne additional paragraph boundaries for the) +177.916 444 R F1({)2.783 E F0(and)2.782 E F1(})2.782 E F0 2.782(commands. The) +2.782 F -.25(va)2.782 G .282(lue of this option).25 F +(must be a character string consisting of zero or more character pairs.)131 456 +Q .59(In the te)131 474 R .59(xt to be edited, the character string ., \(where is one of the) +-.2 F .686(character pairs in the option')131 486 R 3.186(sv)-.55 G .686 +(alue\) de\214nes a paragraph boundary)259.99 486 R 5.686(.F)-.65 G .686(or e) +416.19 486 R .686(xample, if the option were)-.15 F(set to `)131 498 Q +(`LaA ##')-.74 E(', then all of the follo)-.74 E +(wing additional paragraph boundaries w)-.25 E(ould be recognized:)-.1 E F2 +(.La)161 510 Q(.A)161 522 Q(.##)161 534 Q +(prompt [on])102 546 Q F3(Ex)131 558 Q F0(only)2.697 E 5.197(.T)-.65 G .197 +(his option causes)176.634 558 R F3(ex)2.698 E F0 .198 +(to prompt for command input with a `)2.698 F(`:')-.74 E 2.698('c)-.74 G .198 +(haracter; when it')433.948 558 R 2.698(sn)-.55 G .198(ot set,)515.912 558 R +(no prompt is displayed.)131 570 Q F2(readonly, ro [off])102 582 Q F0 .05(This\ + option causes a force \215ag to be required to attempt to write the \214le ba\ +ck to the original \214le name.)131 594 R .833(Setting this option is equi)131 +606 R -.25(va)-.25 G .833(lent to using the).25 F F34.999 E F0 .833 +(command line option, or editing a \214le which lacks)3.333 F +(write permission.)131 618 Q F2(recdir [/var/tmp/vi.recover])102 630 Q F0 +(The directory where reco)131 642 Q -.15(ve)-.15 G(ry \214les are stored.).15 E +F2(redraw, re [off])102 654 Q F3(Vi)131 666 Q F0(only)2.837 E 5.337(.T)-.65 G +.336(he editor simulates \(using great amounts of output\), an intelligent ter\ +minal on a dumb ter)176.914 666 R(-)-.2 E .714(minal \(e.g. during insertions \ +in visual mode the characters to the right of the cursor are refreshed as)131 +678 R(each input character is typed\).)131 690 Q 167.75(4.4BSD March)72 750 R +(18, 1994)2.5 E(7)535 750 Q EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F/F1 10/Times-Italic@0 SF(This option is not yet implemented.) +131 96 Q/F2 10/Courier@0 SF(remap [on])102 108 Q F0 .856 +(If this option is set, it')131 120 R 3.356(sp)-.55 G .856 +(ossible to de\214ne macros in terms of other macros.)235.316 120 R .855 +(Otherwise, each k)5.855 F 1.155 -.15(ey i)-.1 H(s).15 E .366 +(only remapped up to one time.)131 132 R -.15(Fo)5.366 G 2.866(re).15 G .366 +(xample, if `)281.302 132 R(`A')-.74 E 2.866('i)-.74 G 2.866(sm)349.79 132 S +.366(apped to `)364.326 132 R(`B')-.74 E .367(', and `)-.74 F(`B')-.74 E 2.867 +('i)-.74 G 2.867(sm)467.059 132 S .367(apped to `)481.596 132 R(`C')-.74 E(',) +-.74 E(The k)131 144 Q -.15(ey)-.1 G(strok).15 E 2.5(e`)-.1 G(`A')192.67 144 Q +2.5('w)-.74 G(ill be mapped to `)218.86 144 Q(`C')-.74 E 2.5('i)-.74 G(f)309.87 +144 Q/F3 10/Times-Bold@0 SF -.18(re)2.5 G(map).18 E F0(is set, and to `)2.5 E +(`B')-.74 E 2.5('i)-.74 G 2.5(fi)422.08 144 S 2.5(ti)430.69 144 S 2.5(sn)438.75 +144 S(ot set.)450.14 144 Q F2(remapmax [on])102 156 Q F0 .259 +(If this option is set, a k)131 168 R .558 -.15(ey m)-.1 H .258 +(ay only be remapped 50 times.).15 F .258(If it is not set, a k)5.258 F .558 +-.15(ey m)-.1 H .258(ay be remapped an).15 F(in\214nite number of times, and t\ +he editor can be placed into in\214nite loops.)131 180 Q F2(report [5])102 192 +Q F0 .083(Set the threshold of the number of lines that need to be changed bef\ +ore a message will be displayed to)131 204 R .824(the user)131 216 R 5.824(.T) +-.55 G .824(he v)177.088 216 R .824(alue is the lar)-.25 F .824(gest v)-.18 F +.824(alue about which the editor is silent, i.e. by def)-.25 F .823 +(ault, 6 lines must)-.1 F(change before the user is noti\214ed.)131 228 Q F2 +(ruler [off])102 240 Q/F4 10/Courier-Bold@0 SF(Vi)131 252 Q F0(only)2.5 E 5(.D) +-.65 G(isplay a ro)177.35 252 Q(w/column ruler on the colon command line.)-.25 +E F2(scroll, scr [window / 2])102 264 Q F0 +(Set the number of lines scrolled by the)131 276 Q F4(vi)2.5 E F0(commands)2.5 +E F3(^D)2.5 E F0(and)2.5 E F3(^U)2.5 E F0(.)A(Historically)131 294 Q 2.762(,t) +-.65 G(he)185.612 294 Q F4(ex)2.762 E F3(z)2.762 E F0 .262 +(command, when speci\214ed without a count, used tw)2.762 F 2.763(ot)-.1 G .263 +(imes the size of the scroll)436.755 294 R -.25(va)131 306 S +(lue; the POSIX 1003.2 standard speci\214ed the windo).25 E 2.5(ws)-.25 G +(ize, which is a better choice.)361.31 306 Q F2(sections, sect [NHSHH HUnhsh]) +102 318 Q F4(Vi)131 330 Q F0(only)4.4 E 6.9(.D)-.65 G 1.899 +(e\214ne additional section boundaries for the)181.15 330 R F3([[)4.399 E F0 +(and)4.399 E F3(]])4.399 E F0 4.399(commands. The)4.399 F F3(sections)4.399 E +F0(option)4.399 E .369(should be set to a character string consisting of zero \ +or more character pairs.)131 342 R .37(In the te)5.37 F .37(xt to be edited,) +-.15 F .108(the character string ., \(where is one of the character pairs in the op-)-.2 F(tion')131 366 Q 3.422 +(sv)-.55 G .922(alue\), de\214nes a section boundary in the same manner that) +161.402 366 R F3(paragraph)3.422 E F0 .923(option boundaries are)3.422 F +(de\214ned.)131 378 Q F2(shell, sh [environment variable SHELL, or /bin/sh])102 +390 Q F0 .026(Select the shell used by the editor)131 402 R 5.026(.T)-.55 G +.026(he speci\214ed path is the pathname of the shell in)278.672 402 R -.2(vo) +-.4 G -.1(ke).2 G 2.526(db).1 G 2.526(yt)499.872 402 S(he)510.178 402 Q F4(vi) +2.526 E F3(!)2.526 E F0 .383(shell escape command and by the)131 414 R F4(ex) +2.883 E F3(shell)2.883 E F0 2.883(command. This)2.883 F .383 +(program is also used to resolv)2.883 F 2.883(ea)-.15 G .683 -.15(ny s)508.377 +414 T(hell).15 E(meta-characters in)131 426 Q F4(ex)2.5 E F0(commands.)2.5 E F2 +(shiftwidth, sw [8])102 438 Q F0 .026 +(Set the autoindent and shift command indentation width.)131 450 R .025 +(This width is used by the)5.025 F F3(autoindent)2.525 E F0(option)2.525 E +(and by the)131 462 Q F3(<)2.5 E F0(,)A F3(>)2.5 E F0 2.5(,a)C(nd)201 462 Q F3 +(shift)2.5 E F0(commands.)2.5 E F2(showdirty [off])102 474 Q F4(Vi)131 486 Q F0 +(only)2.5 E 5(.D)-.65 G(isplay an asterisk on the colon command line if the \ +\214le has been modi\214ed.)177.35 486 Q F2(showmatch, sm [off])102 498 Q F4 +(Vi)131 510 Q F0(only)2.793 E 5.293(.T)-.65 G .293(his option causes)176.826 +510 R F4(vi)2.793 E F0 2.793(,w)C .294(hen a `)273.048 510 R(`}')-.74 E 2.794 +('o)-.74 G 2.794(r`)321.95 510 S(`\)')330.664 510 Q 2.794('i)-.74 G 2.794(se) +348.818 510 S .294(ntered, to brie\215y mo)359.942 510 R .594 -.15(ve t)-.15 H +.294(he cursor the match-).15 F(ing `)131 522 Q(`{')-.74 E 2.5('o)-.74 G 2.5 +(r`)170.42 522 S(`\(')178.84 522 Q('. See the)-.74 E F3(matchtime)2.5 E F0 +(option for more information.)2.5 E F2(showmode [off])102 534 Q F4(Vi)131 546 Q +F0(only)3.631 E 6.131(.T)-.65 G 1.131(his option causes)178.502 546 R F4(vi) +3.631 E F0 1.131(to display the strings `)3.631 F(`Command')-.74 E 3.63('o)-.74 +G 3.63(r`)420.58 546 S(`Input')430.13 546 Q 3.63('o)-.74 G 3.63(nt)469.12 546 S +1.13(he colon com-)480.53 546 R +(mand line, based on the current mode of the editor)131 558 Q(.)-.55 E F2 +(sidescroll [16])102 570 Q F4(Vi)131 582 Q F0(only)3.003 E 5.503(.S)-.65 G .504 +(ets the number of columns that are shifted to the left or right, when)176.696 +582 R F4(vi)3.004 E F0 .504(is doing left-right)3.004 F +(scrolling and the left or right mar)131 594 Q(gin is crossed.)-.18 E(See the)5 +E F3(leftright)2.5 E F0(option for more information.)2.5 E F2 +(slowopen, slow [off])102 606 Q F0 1.205(This option af)131 618 R 1.205 +(fects the display algorithm used by)-.25 F F4(vi)3.705 E F0 3.705(,h)C 1.205 +(olding of)361.915 618 R 3.704(fd)-.25 G 1.204(isplay updating during input of) +411.294 618 R(ne)131 630 Q 2.5(wt)-.25 G -.15(ex)152.69 630 S 2.5(tt).15 G 2.5 +(oi)170.04 630 S(mpro)180.32 630 Q .3 -.15(ve t)-.15 H +(hroughput when the terminal in use is slo).15 E 2.5(wa)-.25 G +(nd unintelligent.)395.03 630 Q F1(This option is not yet implemented.)131 642 +Q F2(sourceany [off])102 654 Q F0 .756(If this option is turned on,)131 666 R +F4(vi)3.256 E F0 .756(historically read startup \214les that were o)3.256 F +.756(wned by someone other than)-.25 F .834(the editor user)131 678 R 5.834(.S) +-.55 G .834(ee the ST)203.222 678 R(AR)-.93 E .834(TUP INFORMA)-.6 F .834 +(TION section for more information.)-1.11 F .833(This option is a)5.833 F +(security problem of immense proportions, and should not be used under an)131 +690 Q 2.5(yc)-.15 G(ircumstances.)442.2 690 Q 167.75(4.4BSD March)72 750 R +(18, 1994)2.5 E(8)535 750 Q EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F/F1 10/Times-Italic@0 SF(This option will ne)131 96 Q +(ver be implemented.)-.15 E/F2 10/Courier@0 SF(tabstop, ts [8])102 108 Q F0 +(This option sets tab widths for the editor display)131 120 Q(.)-.65 E F2 +(taglength, tl [0])102 132 Q F0 1.345(This option sets the maximum number of c\ +haracters that are considered signi\214cant in a tag name.)131 144 R +(Setting the v)131 156 Q(alue to 0 mak)-.25 E +(es all of the characters in the tag name signi\214cant.)-.1 E F2 +(tags, tag [tags /var/db/libc.tags /sys/kern/tags])102 168 Q F0 +(Sets the list of tags \214les, in search order)131 180 Q 2.5(,w)-.4 G +(hich are used when the editor searches for a tag.)301.97 180 Q F2 +(term, ttytype, tty [environment variable TERM])102 192 Q F0 .813 +(Set the terminal type.)131 204 R .813(Setting this option causes)5.813 F/F3 10 +/Courier-Bold@0 SF(ex/vi)3.313 E F0 .812(to set \(or reset\) the en)3.313 F +.812(vironmental v)-.4 F(ariable)-.25 E F2(TERM)131 216 Q F0(.)A F2 +(terse [off])102 228 Q F0 .759 +(This option has historically made editor messages less v)131 240 R 3.259 +(erbose. It)-.15 F .76(has no ef)3.259 F .76(fect in this implementa-)-.25 F +2.5(tion. See)131 252 R(the)2.5 E/F4 10/Times-Bold@0 SF -.1(ve)2.5 G(rbose).1 E +F0(option for more information.)2.5 E F2(timeout, to [on])102 264 Q F0 .684 +(If this option is set,)131 276 R F3(ex/vi)3.184 E F0 -.1(wa)3.184 G .684 +(its for a speci\214c period for a subsequent k).1 F .983 -.15(ey t)-.1 H 3.183 +(oc).15 G .683(omplete a k)459.051 276 R .983 -.15(ey m)-.1 H(ap-).15 E .481 +(ping \(see the)131 288 R F4 -.1(ke)2.981 G(ytime).1 E F0 2.981(option\). If) +2.981 F .482(the option is not set, the editor w)2.981 F .482 +(aits until enough k)-.1 F -.15(ey)-.1 G 2.982(sa).15 G .482(re entered)499.818 +288 R(to resolv)131 300 Q 2.5(et)-.15 G(he ambiguity)175.29 300 Q 2.5(,r)-.65 G +-2.25 -.15(eg a)235.47 300 T(rdless of ho).15 E 2.5(wl)-.25 G(ong it tak)308.06 +300 Q(es.)-.1 E F2(ttywerase [off])102 312 Q F3(Vi)131 324 Q F0(only)2.95 E +5.45(.T)-.65 G .45(his option changes ho)177.14 324 R(w)-.25 E F3(vi)2.95 E F0 +.45(does w)2.95 F .449(ord erase during te)-.1 F .449(xt input.)-.15 F .449 +(If this option is set, te)5.449 F .449(xt is)-.15 F(brok)131 336 Q .881 +(en up into tw)-.1 F 3.381(oc)-.1 G .881 +(lasses, blank characters and non-blank characters.)217.094 336 R .882 +(Changing from one class to)5.882 F(another marks the end of a w)131 348 Q +(ord.)-.1 E F2(verbose [off])102 360 Q F0(only)131 372 Q(.)-.65 E F3(Vi)5.61 E +F0 .61(historically bells the terminal for man)3.11 F 3.11(yo)-.15 G -.15(bv) +338.18 372 S .61(ious mistak).15 F .61(es, e.g. trying to mo)-.1 F .91 -.15 +(ve p)-.15 H .61(ast the left-).15 F .462(hand mar)131 384 R .463 +(gin, or past the end of the \214le.)-.18 F .463 +(If this option is set, an error message is displayed for all er)5.463 F(-)-.2 +E(rors.)131 396 Q F2(w300 [no default])102 408 Q F3(Vi)131 420 Q F0(only)3.639 +E 6.139(.S)-.65 G 1.139(et the windo)177.968 420 R 3.639(ws)-.25 G 1.139 +(ize if the baud rate is less than 1200 baud.)244.185 420 R 1.139(See the)6.139 +F F4(windo)3.639 E(w)-.1 E F0 1.138(option for)3.639 F(more information.)131 +432 Q F2(w1200 [no default])102 444 Q F3(Vi)131 456 Q F0(only)2.568 E 5.068(.S) +-.65 G .068(et the windo)175.826 456 R 2.568(ws)-.25 G .068 +(ize if the baud rate is equal to 1200 baud.)238.83 456 R .069(See the)5.069 F +F4(windo)2.569 E(w)-.1 E F0 .069(option for more)2.569 F(information.)131 468 Q +F2(w9600 [no default])102 480 Q F3(Vi)131 492 Q F0(only)2.968 E 5.468(.S)-.65 G +.468(et the windo)176.626 492 R 2.968(ws)-.25 G .467 +(ize if the baud rate is greater than 1200 baud.)240.83 492 R .467(See the) +5.467 F F4(windo)2.967 E(w)-.1 E F0 .467(option for)2.967 F(more information.) +131 504 Q F2(warn [on])102 516 Q F3(Ex)131 528 Q F0(only)2.978 E 5.478(.T)-.65 +G .479(his option causes a w)177.196 528 R .479 +(arning message to the terminal if the \214le has been modi\214ed, since it)-.1 +F -.1(wa)131 540 S 2.5(sl).1 G(ast written, before a)151.73 540 Q F4(!)2.5 E F0 +(command.)2.5 E F2(window, w, wi [environment variable LINES])102 552 Q F0 .185 +(This option determines the def)131 564 R .185 +(ault number of lines in a screenful, as written by the)-.1 F F4(z)2.685 E F0 +2.685(command. It)2.685 F(al-)2.685 E .25 +(so determines the number of lines scrolled by the)131 576 R F3(vi)2.751 E F0 +(commands)2.751 E F4(^F)2.751 E F0(and)2.751 E F4(^B)2.751 E F0 2.751(.T)C .251 +(he v)443.966 576 R .251(alue of windo)-.25 F 2.751(wc)-.25 G(an)530.56 576 Q +.246(be unrelated to the real screen size, although it starts out as the numbe\ +r of lines on the screen \(see the)131 588 R .09(SCREEN SIZING section\).)131 +600 R .09(Setting the v)5.09 F .09(alue of the)-.25 F F4(windo)2.59 E(w)-.1 E +F0 .09(option is the same as using the)2.59 F F34.257 E F0(com-)2.591 E +(mand line option.)131 612 Q .047(If the v)131 630 R .047(alue of)-.25 F F4 +(windo)2.547 E(w)-.1 E F0 .046(\(as set by the)2.547 F F4(windo)2.546 E(w)-.1 E +F0(,)A F4(w300)2.546 E F0(,)A F4(w1200)2.546 E F0(or)2.546 E F4(w9600)2.546 E +F0 .046(options\) is smaller than the ac-)2.546 F .648 +(tual size of the screen, lar)131 642 R .648(ge screen mo)-.18 F -.15(ve)-.15 G +.648(ments will result in displaying only that smaller number of).15 F .24 +(lines on the screen.)131 654 R .24(\(Further mo)5.24 F -.15(ve)-.15 G .24 +(ments in that same area will result in the screen being \214lled.\)).15 F +(This)5.24 E 1.116(can pro)131 666 R 1.116(vide a performance impro)-.15 F -.15 +(ve)-.15 G 1.116(ment when vie).15 F 1.116(wing dif)-.25 F 1.116 +(ferent places in one or more \214les o)-.25 F -.15(ve)-.15 G 3.616(ra).15 G +(slo)131 678 Q 2.5(wl)-.25 G(ink.)154.92 678 Q F2(wrapmargin, wm [0])102 690 Q +F3(Vi)131 702 Q F0(only)2.873 E 5.373(.I)-.65 G 2.873(ft)174.206 702 S .373 +(he v)183.189 702 R .373(alue of wrapmar)-.25 F .373(gin is non-zero,)-.18 F F3 +(vi)2.873 E F0 .373(will break lines, that are more than that number)2.873 F +167.75(4.4BSD March)72 750 R(18, 1994)2.5 E(9)535 750 Q EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(EX/VI REFERENCE MANU)72 48 Q -.834(AL \( 1 \))-.4 F +(BSD Reference Manual)258.235 48 Q(EX/VI REFERENCE MANU)390.972 48 Q -.834 +(AL \( 1 \))-.4 F .403(of characters long, into tw)131 96 R 2.903(ol)-.1 G .404 +(ines at the blank character closest to the v)247.895 96 R 2.904(alue. If)-.25 +F(wrapmar)2.904 E .404(gin is 0, or if)-.18 F(there is no blank character upon\ + which to break the line, the line will not be brok)131 108 Q(en.)-.1 E/F1 10 +/Courier@0 SF(wrapscan, ws [on])102 120 Q F0 .31 +(This option causes searches to wrap around the end or the be)131 132 R .31 +(ginning of the \214le, and back to the start-)-.15 F(ing point.)131 144 Q +(Otherwise, the end or be)5 E(ginning of the \214le terminates the search.)-.15 +E F1(writeany, wa [off])102 156 Q F0 .23(If this option is set, \214le-o)131 +168 R -.15(ve)-.15 G .23(rwriting checks that w).15 F .23 +(ould usually be made before the)-.1 F/F2 10/Times-Bold@0 SF(write)2.73 E F0 +(and)2.73 E F2(xit)2.73 E F0(com-)2.73 E .343 +(mands, or before an automatic write \(see the)131 180 R F2(auto)2.842 E(write) +-.1 E F0 .342(option\), are not made.)2.842 F .342(This allo)5.342 F .342 +(ws a write to)-.25 F(an)131 192 Q 2.5<798c>-.15 G(le, pro)153.35 192 Q +(vided the \214le permissions allo)-.15 E 2.5(wi)-.25 G(t.)311 192 Q 167.75 +(4.4BSD March)72 750 R(18, 1994)2.5 E(10)530 750 Q EP +%%Trailer +end +%%EOF diff --git a/usr.bin/vi/docs/vi.ref.txt b/usr.bin/vi/docs/vi.ref.txt new file mode 100644 index 000000000000..e5fc627072db --- /dev/null +++ b/usr.bin/vi/docs/vi.ref.txt @@ -0,0 +1,634 @@ +EX/VI REFERENCE MANUAL(1) BSD Reference Manual EX/VI REFERENCE MANUAL(1) + +NNAAMMEE + eexx,, vvii,, vviieeww - text editors + +DDEESSCCRRIIPPTTIIOONN + VVii is a screen oriented text editor. EExx is a line-oriented text editor. + EExx and vvii are different interfaces to the same program, and it is possi- + ble to switch back and forth during an edit session. VViieeww is the equiva- + lent of using the --RR (read-only) option of vvii. + + This reference manual is the one provided with the nneexx//nnvvii versions of + the eexx//vvii text editors. NNeexx//nnvvii are intended as bug-for-bug compatible + replacements for the original Fourth Berkeley Software Distribution + (4BSD) eexx and vvii programs. This reference manual is accompanied by a + traditional-style manual page. That manual page describes the function- + ality found in eexx//vvii in far less detail than the description here. In + addition, it describes the system interface to eexx//vvii, e.g. command line + options, environmental variables, and similar things. + + This reference is intended for users already familiar with eexx//vvii. Anyone + else should almost certainly read a good tutorial on the editor first. + If you're in an unfamiliar environment, and you absolutely have to get + work done immediately, see the section entitled FAST STARTUP in the manu- + al page. It's probably enough to get you going. + + For the rest of this reference, nneexx//nnvvii is used only when it's necessary + to distinguish it from the historic implementations of eexx//vvii. + +AADDDDIITTIIOONNAALL FFEEAATTUURREESS + There are a few features in nneexx//nnvvii that are not found in historic ver- + sions of eexx//vvii. A list of those features is as follows: + + 8-bit clean data, large lines, files + NNvvii//nneexx will edit any format file. Line lengths are limited by + available memory, and file sizes are limited by available disk + space. The command ``^Vx[0-9A-Fa-f]*'', in input mode, will in- + sert any legal character value into the text. + + Split screens + The command ``:sp[lit] [file ...]'' splits the screen in vi mode. + The key ``^W'' switches between the foreground screens, and the + ``:resize count'' command can be used to grow or shrink a partic- + ular screen. + + Background and foreground screens + The command ``:bg'' backgrounds the current screen, and the com- + mand ``:fg [file]'' foregrounds the backgrounded screen that is + editing the specified file, or, by default, the first background + screen on the queue. The command ``:di[splay] s[creens]'' lists + the background screens. + + Shell screens + The command ``:sc[ript] [file ...]'' runs a shell in the screen. + Editing is unchanged, with the exception that a + enters the current line (stripped of any prompt) as input to the + shell. + + Tag stacks + Tags are now maintained in a stack. The command ``^T'' returns + to the previous tag location. The command ``:tagpop [number + file]'' 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 the specified file. Use the command ``:di[splay] + t[ags]'' to view the tags stack. The command ``:tagtop'' returns + + to the top of the tag stack. + + New displays + The command ``:di[splay] b[uffers] s[creens] t[ags]'' can be + used to display, respectively, the current cut buffers, the back- + grounded screens, and the tags stack. + + Infinite undo + The changes made during an edit session may be rolled backward + and forward. A '.' command immediately after a 'u' command con- + tinues either forward or backward depending on whether the 'u' + command was an undo or a redo. + + Usage information + The command ``:exu[sage] [cmd]'' and ``viu[sage] [key]'' provide + usage information for all of the ex and vi commands by default, + or, optionally, for a specific command or key. + + Extended regular expressions + The ``:set extended'' command treats search and other command + regular expressions as extended (egrep(1) style) regular expres- + sions. + + Word search + The command ``^A'' searches for the word referenced by the cur- + sor. + + Number increment + The command ``#'' increments the number referenced by the cursor. + + Previous file + The command ``:prev[ious][!]'' edits the previous file from the + argument list. + + Left-Right scrolling + The command ``:set leftright'' makes nnvvii do left-right screen + scrolling, instead of the traditional vvii line wrapping. + +RREECCOOVVEERRYY + There is no recovery program for nnvvii, nor does nnvvii run setuid. Users may + recover any file which they may read, and the superuser may recover any + edit session. + + Edit sessions are backed by files in _/_v_a_r_/_t_m_p_/_v_i_._r_e_c_o_v_e_r, and are named + ``vi.XXXX'', where ``XXXX'' is a number related to the process id. When + a file is first modified, a second file, which contains an email message + for the user, is created, and is named ``recover.XXXX'', where, again, + ``XXXX'' 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 enters the ex/vi ``preserve'' command. + The use of the _/_v_a_r_/_t_m_p directory may be changed setting the rreeccddiirr op- + tion in the user's or system startup information. + + The recovery directory should have the ``sticky-bit'' set so that only + the owners of files may remove them. If this is not possible on the sys- + tem, then a pseudo-user should own the recovery directory. The recovery + directory must be both read and write-able by any user. + + 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 sendmail. When the system is rebooted, all + of the files in _/_v_a_r_/_t_m_p_/_v_i_._r_e_c_o_v_e_r named ``recover.XXXX'' should be sent + by email, using the --tt flag of sendmail (or a similar mechanism in other + mailers). A simple way to do this is to insert the following script into + + your _/_e_t_c_/_r_c_._l_o_c_a_l (or other startup) file: + virecovery=`echo /var/tmp/vi.recover/recover.*` + if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then + echo 'Recovering vi editor sessions' + for i in $virecovery; do + sendmail -t < $i + done + fi + + If eexx//vvii receives a hangup (SIGHUP) signal, it will email the recovery + information to the user itself. + + If you don't have the sendmail program on your system, the source file + _n_v_i_/_r_e_c_o_v_e_r_._c will have to be modified to use your local mail delivery + programs. + +SSTTAARRTTUUPP IINNFFOORRMMAATTIIOONN + EExx//vvii 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 eexx commands, not vvii commands. In addition, they + are interpreted _b_e_f_o_r_e the file to be edited is read, and therefore many + eexx 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. + + First, the file _/_e_t_c_/_v_i_._e_x_r_c is read. Second, the environmental variable + NEXINIT (or the variable EXINIT, if NEXINIT isn't set) is interpreted. + Third, if neither NEXINIT or EXINIT was set, the file _$_H_O_M_E_/_._n_e_x_r_c (or + the file _$_H_O_M_E_/_._e_x_r_c, if _$_H_O_M_E_/_._n_e_x_r_c doesn't exist) is read. Fourth, + the file _._n_e_x_r_c (or the file _._e_x_r_c, if _._n_e_x_r_c doesn't exist) is read. + + Startup files will not be read if they are owned by anyone other than the + real user-id of the user running vvii, (or by ``root'' in the case of the + file _/_e_t_c_/_v_i_._e_x_r_c) or if they are writable by anyone other than the own- + er. Home directory startup files (i.e. _$_H_O_M_E_/_._n_e_x_r_c and _$_H_O_M_E_/_._e_x_r_c) + will not be read if the ``HOME'' environmental variable is not set. Lo- + cal startup files (i.e. _._n_e_x_r_c and _._e_x_r_c) will not be read if the eexxrrcc + option is turned off in the _/_e_t_c_/_v_i_._e_x_r_c, _$_H_O_M_E_/_._n_e_x_r_c, or _$_H_O_M_E_/_._e_x_r_c + files, or in the NEXINIT or EXINIT environmental variables. It is not an + error for any of the startup environmental variables or files not to ex- + ist. + + Because the eexx command set supported by nneexx//nnvvii is a superset of the com- + mand set supported by most historical implementations of eexx, nneexx//nnvvii can + use the startup files created for the historical implementations, but the + converse is often not true. + +SSIIZZIINNGG TTHHEE SSCCRREEEENN + The size of the screen can be set in a number of ways. EExx//vvii takes the + following steps until values are obtained for both the number of rows and + number of columns in the screen. + + 1. If the environmental variable LINES exists, it is used to specify + the number of rows in the screen. + 2. If the environmental variable COLUMNS exists, it is used to specify + the number of columns in the screen. + 3. The TIOCGWINSZ ioctl(2) is attempted on the standard error file de- + scriptor. + 4. The termcap entry is checked for the ``li'' entry (rows) and the + ``co'' entry (columns). + 5. The number of rows is set to 24, and the number of columns is set to + 80. + + If a window change size signal (SIGWINCH) is received, the same steps are + taken with the exception that the first two steps are skipped. + +RREEGGUULLAARR EEXXPPRREESSSSIIOONNSS AANNDD RREEPPLLAACCEEMMEENNTT SSTTRRIINNGGSS + Regular expressions are used in line addresses, as the first part of + ssuubbssttiittuuttee, gglloobbaall, and vvgglloobbaall commands, and in search patterns. + + The regular expressions supported by eexx and vvii are, by default, the Basic + Regular Expressions (BRE's) described in the IEEE POSIX Standard 1003.2. + The eexxtteennddeedd option causes all regular expressions to be interpreted as + the Extended Regular Expressions (ERE's) described by the same standard. + (See re_format(7) for more information. Generally speaking, BRE's are + ed(1) and grep(1) style regular expressions, and ERE's are egrep(1) style + regular expressions.) + + There are some special strings and characters that can be used in RE's: + 1. An empty RE (e.g. ``//'') is equivalent to the last RE used. + 2. The construct ``\<'' matches the beginning of a word. + 3. The construct ``\>'' matches the end of a word. + 4. The character ``~'' matches the replacement part of the last + ssuubbssttiittuuttee command. + + When the mmaaggiicc option is _n_o_t set, the only characters with special mean- + ings are ``^'' at the beginning of an RE, ``$'' at the end of an RE, and + the escaping character ``\''. The characters ``.'', ``*'', ``['', and + ``~'' are treated as ordinary characters unless preceded by a ``\''; when + preceded by a ``\'' they regain their special meaning. + + Replacement strings are the second part of a ssuubbssttiittuuttee command. + + The character ``&'' (or ``\&'' if the mmaaggiicc option is _n_o_t set) in the re- + placement string stands for the text matched by the RE that's being re- + placed. The character ``~'' (or ``\~'' if the mmaaggiicc option is _n_o_t set) + stands for the replacement part of the previous ssuubbssttiittuuttee command. + + The string ``\#'', where ``#'' is an integer value from 1 to 9, stands + for the text matched by the portion of the RE enclosed in the #'th set of + escaped parentheses, e.g. ``\('' and ``\)''. For example, + ``s/abc\(.*\)def/\1/'' deletes the strings ``abc'' and ``def'' from the + matched pattern. + + The strings ``\l'', ``\u'', ``\L'', and ``\U'' can be used to modify the + case of elements in the replacement string. The string ``\l'' causes the + next character to be converted to lowercase; the string ``\u'' behaves + similarly, but converts to uppercase. The strings ``\L'' causes charac- + ters up to the end of the string or the next occurrence of the strings + ``\e'' or ``\E'' to be converted to lowercase; the string ``\U'' behaves + similarly, but converts to uppercase. + + In vvii, inserting a into the replacement string will cause the + matched line to be split into two lines at that point. + +SSEETT OOPPTTIIOONNSS + 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 abbre- + viations and their default values. + + 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 charac- + ters necessary to distinguish an abbreviation from all other commands for + it to be accepted, in nneexx//nnvvii. Historically, only the full name and the + official abbreviations were accepted by eexx//vvii. 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 op- + tion. Most of the options are boolean, i.e. they are either on or off, + and do not have an associated value. + + + Options apply to both eexx and vvii modes, unless otherwise specified. + + For information on modifying the options or to display the options and + their current values, see the ``set'' command in the Ex Commands section. + altwerase [off] + VVii only. Change how vvii does word erase during text input. When + this option is set, text is broken up into three classes: alphabet- + ic, numeric and underscore characters, other non-blank 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). + autoindent, ai [off] + If this option is set, whenever you create a new line (using the vvii + AA, aa, CC, cc, II, ii, OO, oo, RR, rr, SS, and ss commands, or the eexx aappppeenndd, + cchhaannggee, and iinnsseerrtt commands) the new line is automatically indented + to align the cursor with the first non-blank 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 ttaabbssttoopp option) + and then using space characters as necessary. For commands insert- + ing text into the middle of a line, any blank characters to the + right of the cursor are discarded, and the first non-blank charac- + ter to the right of the cursor is aligned as described above. + + The indent characters are themselves somewhat special. If you do + not enter more characters on the new line before moving moving to + another line, or entering , the indent character will be + deleted and the line will be empty. For example, if you enter + twice in succession, the line created by the + first will not have any characters in it, regard- + less of the indentation of the previous or subsequent line. + + 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 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 ^^DD key would erase the indent characters. Both the ^^DD key and + the usual erase keys work in nnvvii ..)) In addition, if the cursor is + positioned at the end of the indent characters, the keys ``0^D'' + will erase all of the indent characters for the current line, re- + setting the indentation level to 0. Similarly, the keys ``^^D'' + (i.e. a carat followed by a ) will erase all of the in- + dent characters for the current line, leaving the indentation level + for future created lines unaffected. + + Finally, if aauuttooiinnddeenntt is set, the SS and cccc commands change from + the first non-blank of the line to the end of the line, instead of + from the beginning of the line to the end of the line. + autoprint, ap [off] + EExx only. EExx only. Cause the current line to be automatically dis- + played after the eexx commands <<, >>, ccooppyy, ddeelleettee, jjooiinn, mmoovvee, ppuutt, + tt, UUnnddoo, and uunnddoo. This automatic display is suppressed during + gglloobbaall and vvgglloobbaall commands, and for any command where optional + flags are used to explicitly display the line. + autowrite, aw [off] + If this option is set, the vvii !! ^^^^ ^^]] and ^^ZZ commands, and the eexx + eeddiitt, nneexxtt, rreewwiinndd, ssttoopp, ssuussppeenndd, ttaagg, ttaaggppoopp, and ttaaggttoopp 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. + + Appending the optional force flag ``!'' to the eexx commands nneexxtt, + rreewwiinndd, ssttoopp, ssuussppeenndd, ttaagg, ttaaggppoopp, and ttaaggttoopp stops the automatic + write from being attempted. + + + (Historically, the nneexxtt command ignored the optional force flag.) + Note, the eexx commands eeddiitt, qquuiitt, sshheellll, and xxiitt are _n_o_t affected + by the aauuttoowwrriittee option. + beautify, bf [off] + If this option is set, all control characters that are not current- + ly being specially interpreted, other than , , and + , are discarded from commands read in by eexx from command + files, and from input text entered to vvii (either into the file or + to the colon command line). Text files read by eexx//vvii are _n_o_t af- + fected by the bbeeaauuttiiffyy option. + cdpath [environment variable CDPATH, or ``.''] + This option is used to specify a colon separated list of directo- + ries which are used as path prefixes for any relative path names + used as arguments for the ccdd command. The value of this option de- + faults to the value of the environmental variable CDPATH if it is + set, otherwise to the current directory. For compatibility with + the POSIX 1003.2 shell, the ccdd command does _n_o_t check the current + directory as a path prefix for relative path names unless it is ex- + plicitly specified. It may be so specified by entering an empty + string or a ``.'' into the CDPATH variable or the option value. + columns, co [80] + The number of columns in the screen. Setting this option causes + eexx//vvii to set (or reset) the environmental variable COLUMNS. See the + SCREEN SIZING section for more information. + comment [off] + VVii only. If the first non-empty line of the file begins with the + string ``/*'', this option causes vvii to skip to the end of that C + comment (probably a terribly boring legal notice) before displaying + the file. + directory, dir [environment variable TMPDIR, or /tmp] + The directory where temporary files are created. The environmental + variable TMPDIR is used as the default value if it exists, other- + wise _/_t_m_p is used. + edcompatible, ed [off] + This option causes the presence or absence of gg and cc suffixes on + ssuubbssttiittuuttee commands to be remembered, and to be toggled by repeat- + ing the suffices. The suffix rr makes the substitution be as in the + ~~ command, instead of like the && command. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + errorbells, eb [off] + EExx only. Causes eexx error messages to be preceded by a bell. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + exrc, ex [off] + If this option is turned off in the system or $HOME startup files, + the local startup files are never read (unless they are the same as + the system or $HOME startup files). Turning it on has no effect, + i.e. the normal checks for local startup files are performed, re- + gardless. See the STARTUP INFORMATION section for more informa- + tion. + extended [off] + This option causes all regular expressions to be treated as POSIX + 1003.2 extended regular expressions (which are similar to historic + egrep(1) style expressions). + flash [on] + This option causes the screen to flash instead of beeping the key- + board, on error, if the terminal has the capability. + 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 nneexx//nnvvii never writes tabs to the terminal, unlike his- + toric versions of eexx//vvii, this option does not currently have any + affect. + ignorecase, ic [off] + This option causes regular expressions, both in eexx commands and in + + searches, to be evaluated in a case-insensitive manner. + keytime [6] + The 10th's of a second eexx//vvii waits for a subsequent key to complete + a key mapping. + leftright [off] + VVii only. This option causes the screen to be scrolled left-right + to view lines longer than the screen, instead of the traditional vvii + screen interface which folds long lines at the right-hand margin of + the terminal. + lines, li [24] + VVii only. The number of lines in the screen. Setting this option + causes eexx//vvii to set (or reset) the environmental variable LINES. + See the Screen Sizing section for more information. + lisp [off] + VVii only. This option changes the behavior of the vvii ((, )), {{, }}, [[[[ + and ]]]] commands to match the Lisp language. Also, the aauuttooiinnddeenntt + option's behavior is changed to be appropriate for Lisp. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + list [off] + This option causes lines to be displayed in an unambiguous fashion. + Specifically, tabs are displayed as control characters, i.e. + ``^I'', and the ends of lines are marked with a ``$'' character. + magic [on] + This option is on by default. Turning the mmaaggiicc option off causes + all regular expression characters except for ``^'' and ``$'', to be + treated as ordinary characters. To re-enable characters individu- + ally, when the mmaaggiicc option is off, precede them with an ``\''. See + the REGULAR EXPRESSIONS AND REPLACEMENT STRINGS section for more + information. + matchtime [7] + VVii only. The 10th's of a second eexx//vvii pauses on the matching char- + acter when the sshhoowwmmaattcchh option is set. + mesg [on] + This option allows other users to contact you using the talk(1) and + write(1) utilities, while you are editing. EExx//vvii 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 mesg(1) utility + for more information. + modelines, modeline [off] + If the mmooddeelliinneess option is set, eexx//vvii has historically scanned the + first and last five lines of each file as it is read for editing, + looking for any eexx 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. Commands are recognized by the letters ``e'' or ``v'' + followed by ``x'' or ``i'', at the beginning of a line or following + a tab or space character, and followed by a ``:'', an eexx command, + and another ``:''. This option is a security problem of immense + proportions, and should not be used under any circumstances. + _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_. + number, nu [off] + Precede each line displayed with its current line number. + open [on] + EExx only. If this option is not set, the ooppeenn and vviissuuaall commands + are disallowed. + optimize, opt [on] + VVii only. Throughput of text is expedited by setting the terminal + to no 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. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + paragraphs, para [IPLPPPQPP LIpplpipbp] + VVii only. Define additional paragraph boundaries for the {{ and }} + commands. The value of this option must be a character string con- + sisting of zero or more character pairs. + + In the text to be edited, the character string ., (where is one of the character pairs in the op- + tion's value) defines a paragraph boundary. For example, if the + option were set to ``LaA ##'', then all of the following additional + paragraph boundaries would be recognized: + .La + .A + .## + prompt [on] + EExx only. This option causes eexx to prompt for command input with a + ``:'' character; when it's not set, no prompt is displayed. + readonly, ro [off] + This option causes a force flag to be required to attempt to write + the file back to the original file name. Setting this option is + equivalent to using the --RR command line option, or editing a file + which lacks write permission. + recdir [/var/tmp/vi.recover] + The directory where recovery files are stored. + redraw, re [off] + VVii only. The editor simulates (using great amounts of output), an + intelligent terminal on a dumb terminal (e.g. during insertions in + visual mode the characters to the right of the cursor are refreshed + as each input character is typed). + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + remap [on] + If this option is set, it's possible to define macros in terms of + other macros. Otherwise, each key is only remapped up to one time. + For example, if ``A'' is mapped to ``B'', and ``B'' is mapped to + ``C'', The keystroke ``A'' will be mapped to ``C'' if rreemmaapp is set, + and to ``B'' if it is not set. + remapmax [on] + If this option is set, a key may only be remapped 50 times. If it + is not set, a key may be remapped an infinite number of times, and + the editor can be placed into infinite loops. + report [5] + Set the threshold of the number of lines that need to be changed + before a message will be displayed to the user. The value is the + largest value about which the editor is silent, i.e. by default, 6 + lines must change before the user is notified. + ruler [off] + VVii only. Display a row/column ruler on the colon command line. + scroll, scr [window / 2] + Set the number of lines scrolled by the vvii commands ^^DD and ^^UU. + + Historically, the eexx zz command, when specified without a count, + used two times the size of the scroll value; the POSIX 1003.2 stan- + dard specified the window size, which is a better choice. + sections, sect [NHSHH HUnhsh] + VVii only. Define additional section boundaries for the [[[[ and ]]]] + commands. The sseeccttiioonnss option should be set to a character string + consisting of zero or more character pairs. In the text to be + edited, the character string ., (where is one of the character pairs in the option's value), defines + a section boundary in the same manner that ppaarraaggrraapphh option bound- + aries are defined. + 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 vvii !! shell escape command and + by the eexx sshheellll command. This program is also used to resolve any + shell meta-characters in eexx commands. + shiftwidth, sw [8] + Set the autoindent and shift command indentation width. This width + is used by the aauuttooiinnddeenntt option and by the <<, >>, and sshhiifftt com- + + mands. + showdirty [off] + VVii only. Display an asterisk on the colon command line if the file + has been modified. + showmatch, sm [off] + VVii only. This option causes vvii, when a ``}'' or ``)'' is entered, + to briefly move the cursor the matching ``{'' or ``(''. See the + mmaattcchhttiimmee option for more information. + showmode [off] + VVii only. This option causes vvii to display the strings ``Command'' + or ``Input'' on the colon command line, based on the current mode + of the editor. + sidescroll [16] + VVii only. Sets the number of columns that are shifted to the left + or right, when vvii is doing left-right scrolling and the left or + right margin is crossed. See the lleeffttrriigghhtt option for more infor- + mation. + slowopen, slow [off] + This option affects the display algorithm used by vvii, holding off + display updating during input of new text to improve throughput + when the terminal in use is slow and unintelligent. + _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. + sourceany [off] + If this option is turned on, vvii historically read startup files + that were owned by someone other than the editor user. See the + STARTUP INFORMATION section for more information. This option is a + security problem of immense proportions, and should not be used un- + der any circumstances. + _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_. + tabstop, ts [8] + This option sets tab widths for the editor display. + taglength, tl [0] + This option sets the maximum number of characters that are consid- + ered significant in a tag name. Setting the value to 0 makes all + of the characters in the tag name significant. + 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. + term, ttytype, tty [environment variable TERM] + Set the terminal type. Setting this option causes eexx//vvii to set (or + reset) the environmental variable TERM. + terse [off] + This option has historically made editor messages less verbose. It + has no effect in this implementation. See the vveerrbboossee option for + more information. + timeout, to [on] + If this option is set, eexx//vvii waits for a specific period for a sub- + sequent key to complete a key mapping (see the kkeeyyttiimmee option). If + the option is not set, the editor waits until enough keys are en- + tered to resolve the ambiguity, regardless of how long it takes. + ttywerase [off] + VVii only. This option changes how vvii does word erase during text + input. If this option is set, text is broken up into two classes, + blank characters and non-blank characters. Changing from one class + to another marks the end of a word. + verbose [off] + only. VVii historically bells the terminal for many obvious mis- + takes, 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 dis- + played for all errors. + w300 [no default] + VVii only. Set the window size if the baud rate is less than 1200 + baud. See the wwiinnddooww option for more information. + w1200 [no default] + VVii only. Set the window size if the baud rate is equal to 1200 + + baud. See the wwiinnddooww option for more information. + w9600 [no default] + VVii only. Set the window size if the baud rate is greater than 1200 + baud. See the wwiinnddooww option for more information. + warn [on] + EExx only. This option causes a warning message to the terminal if + the file has been modified, since it was last written, before a !! + command. + window, w, wi [environment variable LINES] + This option determines the default number of lines in a screenful, + as written by the zz command. It also determines the number of + lines scrolled by the vvii commands ^^FF and ^^BB. 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 SCREEN SIZING section). + Setting the value of the wwiinnddooww option is the same as using the --ww + command line option. + + If the value of wwiinnddooww (as set by the wwiinnddooww, ww330000, ww11220000 or ww99660000 + 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. (Further movements in that same area will + result in the screen being filled.) This can provide a performance + improvement when viewing different places in one or more files over + a slow link. + wrapmargin, wm [0] + VVii only. If the value of wrapmargin is non-zero, vvii will break + lines, that are more than that number of characters long, into two + lines at the blank character closest to the value. If wrapmargin + is 0, or if there is no blank character upon which to break the + line, the line will not be broken. + 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. + writeany, wa [off] + If this option is set, file-overwriting checks that would usually + be made before the wwrriittee and xxiitt commands, or before an automatic + write (see the aauuttoowwrriittee option), are not made. This allows a + write to any file, provided the file permissions allow it. + +4.4BSD March 18, 1994 10 diff --git a/usr.bin/vi/intr.c b/usr.bin/vi/intr.c new file mode 100644 index 000000000000..08419c3f200c --- /dev/null +++ b/usr.bin/vi/intr.c @@ -0,0 +1,179 @@ +/*- + * Copyright (c) 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)intr.c 8.1 (Berkeley) 3/23/94"; +#endif /* not lint */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compat.h" +#include +#include + +#include "vi.h" + +/* + * There's a count of how deep the interrupt level in the SCR structure + * has gone. Each routine that wants to be interrupted increments this + * level, and decrements it when it tears the interrupts down. There are + * two simplifying assumptions: + * + * 1: All interruptible areas want the same handler (we don't have + * to save/restore the old handler). + * 2: This is the only way to turn on interrupts (we don't have to + * worry about them already being turned on if the interrupt + * level is 0). + * + * We do it this way because interrupts have to be very fast -- if the + * O_REMAPMAX option is turned off, we are setting interrupts per key + * stroke. + * + * If an interrupt arrives, the S_INTERRUPTED bit is set in any SCR that + * has the S_INTERRUPTIBLE bit set. In the future this may be a problem. + * The user should be able to move to another screen and keep typing while + * another screen runs. Currently, if the user does this and the user has + * more than one interruptible thing running, there will be no way to know + * which one to stop. + */ + +static void intr_def __P((int)); + +/* + * intr_init -- + * Set up a interrupts. + */ +int +intr_init(sp) + SCR *sp; +{ + struct sigaction act; + struct termios nterm; + + /* You can never interrupt sessions not using tty's. */ + if (!F_ISSET(sp->gp, G_STDIN_TTY)) + return (1); + + /* If interrupts already set up, just increase the level. */ + if (sp->intr_level++) + return (0); + + /* Turn interrupts on in this screen. */ + F_SET(sp, S_INTERRUPTIBLE); + + /* Install a handler. */ + act.sa_handler = intr_def; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + if (sigaction(SIGINT, &act, &sp->intr_act)) { + msgq(sp, M_SYSERR, "sigaction"); + goto err1; + } + + /* + * Turn on interrupts. ISIG turns on VINTR, VQUIT and VSUSP. We + * want VINTR to interrupt, so we install a handler. VQUIT is + * ignored by main() because nvi never wants to catch it. A handler + * for VSUSP should have been installed by the screen code. + */ + if (tcgetattr(STDIN_FILENO, &sp->intr_term)) { + msgq(sp, M_SYSERR, "tcgetattr"); + goto err2; + } + nterm = sp->intr_term; + nterm.c_lflag |= ISIG; + if (tcsetattr(STDIN_FILENO, TCSANOW | TCSASOFT, &nterm)) { + msgq(sp, M_SYSERR, "tcsetattr"); + /* + * If an error occurs, back out the changes and run + * without interrupts. + */ +err2: (void)sigaction(SIGINT, &sp->intr_act, NULL); +err1: sp->intr_level = 0; + F_CLR(sp, S_INTERRUPTIBLE); + return (1); + } + return (0); +} + +/* + * intr_end -- + * Tear down interrupts. + */ +void +intr_end(sp) + SCR *sp; +{ + /* If not the bottom level of interrupts, just return. */ + if (--sp->intr_level) + return; + + /* Turn off interrupts. */ + if (tcsetattr(STDIN_FILENO, TCSANOW | TCSASOFT, &sp->intr_term)) + msgq(sp, M_SYSERR, "tcsetattr"); + + /* Reset the signal state. */ + if (sigaction(SIGINT, &sp->intr_act, NULL)) + msgq(sp, M_SYSERR, "sigaction"); + + /* Clear interrupt bits in this screen. */ + F_CLR(sp, S_INTERRUPTED | S_INTERRUPTIBLE); +} + +/* + * intr_def -- + * Default interrupt handler. + */ +static void +intr_def(signo) + int signo; +{ + SCR *sp; + + for (sp = __global_list->dq.cqh_first; + sp != (void *)&__global_list->dq; sp = sp->q.cqe_next) + if (F_ISSET(sp, S_INTERRUPTIBLE)) + F_SET(sp, S_INTERRUPTED); +} diff --git a/usr.bin/vi/put.c b/usr.bin/vi/put.c new file mode 100644 index 000000000000..aebefa6fd73a --- /dev/null +++ b/usr.bin/vi/put.c @@ -0,0 +1,249 @@ +/*- + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)put.c 8.3 (Berkeley) 3/14/94"; +#endif /* not lint */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compat.h" +#include +#include + +#include "vi.h" + +/* + * put -- + * Put text buffer contents into the file. + * + * !!! + * Historically, pasting into a file with no lines in vi would preserve + * the single blank line. This is almost certainly a result of the fact + * that historic vi couldn't deal with a file that had no lines in it. + * This implementation treats that as a bug, and does not retain the blank + * line. + */ +int +put(sp, ep, cbp, namep, cp, rp, append) + SCR *sp; + EXF *ep; + CB *cbp; + CHAR_T *namep; + MARK *cp, *rp; + int append; +{ + CHAR_T name; + TEXT *ltp, *tp; + recno_t lno; + size_t blen, clen, len; + char *bp, *p, *t; + + if (cbp == NULL) + if (namep == NULL) { + cbp = sp->gp->dcbp; + if (cbp == NULL) { + msgq(sp, M_ERR, "The default buffer is empty."); + return (1); + } + } else { + name = *namep; + CBNAME(sp, cbp, name); + if (cbp == NULL) { + msgq(sp, M_ERR, + "Buffer %s is empty.", charname(sp, name)); + return (1); + } + } + tp = cbp->textq.cqh_first; + + /* + * It's possible to do a put into an empty file, meaning that the + * cut buffer simply becomes the file. It's a special case so + * that we can ignore it in general. + * + * Historical practice is that the cursor ends up on the first + * non-blank character of the first line inserted. + */ + if (cp->lno == 1) { + if (file_lline(sp, ep, &lno)) + return (1); + if (lno == 0) { + for (; tp != (void *)&cbp->textq; + ++lno, tp = tp->q.cqe_next) + if (file_aline(sp, ep, 1, lno, tp->lb, tp->len)) + return (1); + rp->lno = 1; + rp->cno = 0; + (void)nonblank(sp, ep, rp->lno, &rp->cno); + goto ret; + } + } + + /* If a line mode buffer, append each new line into the file. */ + if (F_ISSET(cbp, CB_LMODE)) { + lno = append ? cp->lno : cp->lno - 1; + rp->lno = lno + 1; + for (; tp != (void *)&cbp->textq; ++lno, tp = tp->q.cqe_next) + if (file_aline(sp, ep, 1, lno, tp->lb, tp->len)) + return (1); + rp->cno = 0; + (void)nonblank(sp, ep, rp->lno, &rp->cno); + goto ret; + } + + /* + * If buffer was cut in character mode, replace the current line with + * one built from the portion of the first line to the left of the + * split plus the first line in the CB. Append each intermediate line + * in the CB. Append a line built from the portion of the first line + * to the right of the split plus the last line in the CB. + * + * Get the first line. + */ + lno = cp->lno; + if ((p = file_gline(sp, ep, lno, &len)) == NULL) { + GETLINE_ERR(sp, lno); + return (1); + } + + GET_SPACE_RET(sp, bp, blen, tp->len + len + 1); + t = bp; + + /* Original line, left of the split. */ + if (len > 0 && (clen = cp->cno + (append ? 1 : 0)) > 0) { + memmove(bp, p, clen); + p += clen; + t += clen; + } + + /* First line from the CB. */ + memmove(t, tp->lb, tp->len); + t += tp->len; + + /* Calculate length left in original line. */ + clen = len ? len - cp->cno - (append ? 1 : 0) : 0; + + /* + * If no more lines in the CB, append the rest of the original + * line and quit. Otherwise, build the last line before doing + * the intermediate lines, because the line changes will lose + * the cached line. + */ + if (tp->q.cqe_next == (void *)&cbp->textq) { + /* + * Historical practice is that if a non-line mode put + * is inside a single line, the cursor ends up on the + * last character inserted. + */ + rp->lno = lno; + rp->cno = (t - bp) - 1; + + if (clen > 0) { + memmove(t, p, clen); + t += clen; + } + if (file_sline(sp, ep, lno, bp, t - bp)) + goto mem; + } else { + /* + * Have to build both the first and last lines of the + * put before doing any sets or we'll lose the cached + * line. Build both the first and last lines in the + * same buffer, so we don't have to have another buffer + * floating around. + * + * Last part of original line; check for space, reset + * the pointer into the buffer. + */ + ltp = cbp->textq.cqh_last; + len = t - bp; + ADD_SPACE_RET(sp, bp, blen, ltp->len + clen); + t = bp + len; + + /* Add in last part of the CB. */ + memmove(t, ltp->lb, ltp->len); + if (clen) + memmove(t + ltp->len, p, clen); + clen += ltp->len; + + /* + * Now: bp points to the first character of the first + * line, t points to the last character of the last + * line, t - bp is the length of the first line, and + * clen is the length of the last. Just figured you'd + * want to know. + * + * Output the line replacing the original line. + */ + if (file_sline(sp, ep, lno, bp, t - bp)) + goto mem; + + /* + * Historical practice is that if a non-line mode put + * covers multiple lines, the cursor ends up on the + * first character inserted. (Of course.) + */ + rp->lno = lno; + rp->cno = (t - bp) - 1; + + /* Output any intermediate lines in the CB. */ + for (tp = tp->q.cqe_next; + tp->q.cqe_next != (void *)&cbp->textq; + ++lno, tp = tp->q.cqe_next) + if (file_aline(sp, ep, 1, lno, tp->lb, tp->len)) + goto mem; + + if (file_aline(sp, ep, 1, lno, t, clen)) { +mem: FREE_SPACE(sp, bp, blen); + return (1); + } + } + FREE_SPACE(sp, bp, blen); + + /* Reporting... */ +ret: sp->rptlines[L_PUT] += lno - cp->lno; + + return (0); +} diff --git a/usr.bin/vi/vi/v_zexit.c b/usr.bin/vi/vi/v_zexit.c new file mode 100644 index 000000000000..15c2b535d17f --- /dev/null +++ b/usr.bin/vi/vi/v_zexit.c @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)v_zexit.c 8.7 (Berkeley) 3/8/94"; +#endif /* not lint */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "compat.h" +#include +#include + +#include "vi.h" +#include "excmd.h" +#include "vcmd.h" + +/* + * v_zexit -- ZZ + * Save the file and exit. + */ +int +v_zexit(sp, ep, vp) + SCR *sp; + EXF *ep; + VICMDARG *vp; +{ + if (F_ISSET(ep, F_MODIFIED) && + file_write(sp, ep, NULL, NULL, NULL, FS_ALL)) + return (1); + + /* + * !!! + * Historic practice: quit! or two quit's done in succession + * (where ZZ counts as a quit) didn't check for other files. + * + * Check for related screens; quit if they exist, the user will + * get a message on the last screen. + */ + if (sp->ccnt != sp->q_ccnt + 1 && + ep->refcnt <= 1 && file_unedited(sp) != NULL) { + sp->q_ccnt = sp->ccnt; + msgq(sp, M_ERR, + "More files to edit; use \":n\" to go to the next file"); + return (1); + } + + F_SET(sp, S_EXIT); + return (0); +}