Termcap update, replacing elvis by nvi.
Removing elvis, importing nvi, ctags, updating libedit. Change-Id: I881eb04d2dc64cf112facd992de1114e1a59107f
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
|
||||
SUBDIR= USD.doc info
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -0,0 +1,5 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
|
||||
SUBDIR= edit exref vi.ref vitut
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -0,0 +1,24 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/8/93
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/edit
|
||||
DIR= usd/11.edit
|
||||
SRCS= edittut.ms
|
||||
MACROS= -ms
|
||||
|
||||
all: paper.ps
|
||||
|
||||
paper.ps: ${SRCS}
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
# index for versatec is different from the one in edit.tut
|
||||
# because the fonts are different and entries reference page
|
||||
# rather than section numbers. if you have a typesetter
|
||||
# you should just use the index in edit.tut, and ignore editvindex.
|
||||
|
||||
editvindex:
|
||||
${TOOL_ROFF_RAW} ${MACROS} -n22 edit.vindex
|
||||
|
||||
.include <bsd.doc.mk>
|
||||
@@ -0,0 +1,113 @@
|
||||
.\" $NetBSD: edit.vindex,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" 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. 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.
|
||||
.\"
|
||||
.\" @(#)edit.vindex 8.1 (Berkeley) 6/8/93
|
||||
.\"
|
||||
.bd I
|
||||
.ND
|
||||
.TL
|
||||
Index
|
||||
.sp 3
|
||||
.2C
|
||||
.nf
|
||||
addressing, \fIsee\fR line numbers
|
||||
append mode, 4
|
||||
backslash (\\), 18
|
||||
buffer, 2
|
||||
command mode, 4
|
||||
context search, 8, 10, 13, 18
|
||||
control characters (``^'' notation), 8
|
||||
control-d, 6
|
||||
current filename, 19, 20
|
||||
current line (.), 9, 15
|
||||
diagnostic messages, 4
|
||||
disk, 2
|
||||
documentation, 21
|
||||
edit (to begin editing session), 3, 7
|
||||
editing commands:
|
||||
.in +2
|
||||
append (a), 4, 7
|
||||
change (c), 16
|
||||
copy (co), 13
|
||||
delete (d), 13-14
|
||||
edit (e), 12
|
||||
file (f), 19
|
||||
global (g), 18-19
|
||||
move (m), 12-13
|
||||
number (nu), 9
|
||||
preserve (pre), 20-21
|
||||
print (p), 8
|
||||
quit (q), 5, 11
|
||||
quit! (q!), 11
|
||||
read (r), 20
|
||||
recover (rec), 20
|
||||
substitute (s), 9-10, 17, 18
|
||||
undo (u), 14, 17
|
||||
write (w), 5-6, 11, 19-20
|
||||
z, 11
|
||||
.sp 10i
|
||||
! (shell escape), 19
|
||||
$= , 15
|
||||
+, 15
|
||||
\-, 15
|
||||
//, 8, 18
|
||||
??, 18
|
||||
\&\fB.\fR, 9, 15
|
||||
\&\fB.\fR=, 9, 15
|
||||
.in -2
|
||||
erasing
|
||||
.ti +2
|
||||
characters (#), 8
|
||||
.ti +2
|
||||
lines (@), 8
|
||||
ex (text editor), 21
|
||||
\fIEx Reference Manual\fR, 21
|
||||
file, 1
|
||||
file recovery, 20
|
||||
filename, 2
|
||||
Interrupt (message), 7
|
||||
line numbers, \fIsee also\fR current line
|
||||
.ti +2
|
||||
dollar sign ($), 8, 12-13, 15
|
||||
.ti +2
|
||||
dot (.), 9, 15
|
||||
.ti +2
|
||||
relative (+ and \-), 15, 16
|
||||
logging out, 6
|
||||
login procedure, 2
|
||||
``magic'' characters, 21
|
||||
non-printing characters, 8
|
||||
``not found'' (message), 3
|
||||
program, 1
|
||||
recovery \fIsee\fR file recovery
|
||||
shell, 18
|
||||
shell escape (!), 19
|
||||
special characters (^, $, \e), 18
|
||||
text input mode, 4
|
||||
UNIX, 1
|
||||
@@ -0,0 +1,21 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.8 (Berkeley) 10/10/96
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/exref
|
||||
|
||||
DIR= usd/12.ex
|
||||
SRCS= ex.rm ex.summary
|
||||
MACROS= -ms
|
||||
CLEANFILES= summary.ps
|
||||
|
||||
all: paper.ps summary.ps
|
||||
|
||||
paper.ps: ex.rm
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
summary.ps: ex.summary
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
.include <bsd.doc.mk>
|
||||
@@ -0,0 +1,35 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.20 (Berkeley) 8/18/96
|
||||
|
||||
DIR= usd/13.viref
|
||||
SRCS= vi.ref ex.cmd.roff set.opt.roff vi.cmd.roff ref.so
|
||||
MACROS= -me
|
||||
CLEANFILES+= vi.ref.txt vi.ref.ps index index.so
|
||||
|
||||
all: vi.ref.txt vi.ref.ps
|
||||
|
||||
vi.ref.txt: vi.ref index.so
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | ${TOOL_ROFF_ASCII} ${MACROS} > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
vi.ref.ps: vi.ref index.so
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
index.so: vi.ref
|
||||
# Build index.so, side-effect of building the paper.
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | \
|
||||
${TOOL_ROFF_PS} ${MACROS} > /dev/null
|
||||
sed -e 's/MINUSSIGN/\\-/' \
|
||||
-e 's/DOUBLEQUOTE/""/' \
|
||||
-e "s/SQUOTE/'/" \
|
||||
-e 's/ /__SPACE/g' < index | \
|
||||
sort -u '-t ' +0 -1 +1n | awk -f merge.awk | \
|
||||
sed -e 's/__SPACE/ /g' > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
.include <bsd.doc.mk>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
# $NetBSD: merge.awk,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
#
|
||||
# @(#)merge.awk 8.3 (Berkeley) 5/25/94
|
||||
#
|
||||
# merge index entries into one line per label
|
||||
$1 == prev {
|
||||
printf ", %s", $2;
|
||||
next;
|
||||
}
|
||||
{
|
||||
if (NR != 1)
|
||||
printf "\n";
|
||||
printf "%s \t%s", $1, $2;
|
||||
prev = $1;
|
||||
}
|
||||
END {
|
||||
printf "\n"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
# $NetBSD: Makefile,v 1.1 2008/09/02 09:25:39 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.7 (Berkeley) 8/18/96
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/vitut
|
||||
DIR= usd/12.vi
|
||||
SRCS= vi.in vi.chars
|
||||
MACROS= -ms
|
||||
CLEANFILES+= vitut.ps summary.ps viapwh.ps
|
||||
|
||||
all: vitut.ps summary.ps viapwh.ps
|
||||
|
||||
vitut.ps: ${SRCS}
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
summary.ps: vi.summary
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
viapwh.ps: vi.apwh.ms
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
.include <bsd.doc.mk>
|
||||
@@ -0,0 +1,55 @@
|
||||
# @(#)ev 8.4 (Berkeley) 4/29/94
|
||||
|
||||
Ev: Vi: Result:
|
||||
<CK> <CK> (Cursor keys). Move around the file.
|
||||
|
||||
Meta key commands:
|
||||
^A<#> <#>G Goto line #.
|
||||
^A$ G Goto the end of the file.
|
||||
^A/ / Prompt and execute a forward search.
|
||||
^A: : Prompt and execute an ex command.
|
||||
^A? ? Prompt and execute a backward search.
|
||||
^Ac y'<c> Copy to mark in line mode (or copy the current line).
|
||||
^AC y`<c> Copy to mark in character mode.
|
||||
^Ad d'<c> Delete to mark in line mode (or delete the current line).
|
||||
^AD d`<c> Delete to mark in character mode.
|
||||
^Aj J Join lines.
|
||||
^Am m<c> Mark the current cursor position.
|
||||
^AN N Repeat search in the reverse direction.
|
||||
^An ^A Search for the word under the cursor.
|
||||
^Ar u Redo a command.
|
||||
^Au u Undo a command.
|
||||
|
||||
Single key commands:
|
||||
^B ^B Page up a screen.
|
||||
^C ^C Interrupt long-running commands.
|
||||
^D ^D Page down a half-screen.
|
||||
^E $ End of line.
|
||||
^F ^F Page down a screen.
|
||||
^G ^G File status/information.
|
||||
^H X Delete the character to the left of the cursor.
|
||||
^I (TAB)
|
||||
^J j Cursor down one line.
|
||||
^K k Cursor up one line.
|
||||
^L ^L Redraw the screen.
|
||||
^M (CR) ^M In insert mode, split the line at the current cursor,
|
||||
creating a new line.
|
||||
In overwrite mode, cursor down one line.
|
||||
^N n Repeat previous search, in previous direction.
|
||||
^O (UNUSED)
|
||||
^P p Paste the cut text at the cursor position.
|
||||
^Q (XON/XOFF)
|
||||
^R (UNUSED)
|
||||
^S (XON/XOFF)
|
||||
^T D Truncate the line at the cursor position.
|
||||
^U ^U Page up a half-screen.
|
||||
^V<c> ^V<c> Insert/overwrite with a literal next character.
|
||||
^W w Move forward one whitespace separated word.
|
||||
^X x Delete the current character.
|
||||
^Y (UNUSED)
|
||||
^Z ^Z Suspend.
|
||||
|
||||
New ex mode commands:
|
||||
|
||||
^A:set ov[erwrite] Toggle "insert" mode, so that input keys overwrite
|
||||
the existing characters.
|
||||
@@ -0,0 +1,230 @@
|
||||
MOVING THE CURSOR:
|
||||
k - cursor up ^F - page forward /<pattern><CR> - search forward
|
||||
j - cursor down ^B - page backward ?<pattern><CR> - search backward
|
||||
h - cursor left w - move forward a "word" n - repeat the last search
|
||||
l - cursor right b - move backward a "word"
|
||||
|
||||
ENTERING TEXT:
|
||||
a - append after the cursor. Use the <escape> key to return to
|
||||
i - insert before the cursor. command mode.
|
||||
o - open a new line below the cursor.
|
||||
O - open new line above the cursor.
|
||||
|
||||
WRITING AND EXITING:
|
||||
:w<Enter> - write the file
|
||||
:q<Enter> - exit the file
|
||||
:q!<Enter> - exit without writing the file
|
||||
:#<Enter> - move to a line (e.g., :35<Enter> moves to line 35)
|
||||
|
||||
MISCELLANEOUS:
|
||||
^G - display the file name
|
||||
J - join two lines (use i<Enter><escape> to split a line)
|
||||
u - undo the last change (enter . after a 'u' to undo more than one change)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
VI COMMANDS:
|
||||
^A search forward for cursor word
|
||||
^B scroll up by screens
|
||||
^C interrupt an operation (e.g. read, write, search)
|
||||
^D scroll down by half screens (setting count)
|
||||
^E scroll down by lines
|
||||
^F scroll down by screens
|
||||
^G file status
|
||||
^H move left by characters
|
||||
^J move down by lines
|
||||
^L redraw screen
|
||||
^M move down by lines (to first non-blank)
|
||||
^N move down by lines
|
||||
^P move up by lines
|
||||
^R redraw screen
|
||||
^T tag pop
|
||||
^U half page up (set count)
|
||||
^V input a literal character
|
||||
^W move to next screen
|
||||
^Y page up by lines
|
||||
^Z suspend editor
|
||||
^[ <escape> exit input mode, cancel partial commands
|
||||
^\ switch to ex mode
|
||||
^] tag push cursor word
|
||||
^^ switch to previous file
|
||||
<space> move right by columns
|
||||
! filter through command(s) to motion
|
||||
# number increment/decrement
|
||||
$ move to last column
|
||||
% move to match
|
||||
& repeat substitution
|
||||
' move to mark (to first non-blank)
|
||||
( move back sentence
|
||||
) move forward sentence
|
||||
+ move down by lines (to first non-blank)
|
||||
, reverse last F, f, T or t search
|
||||
- move up by lines (to first non-blank)
|
||||
. repeat the last command
|
||||
/ search forward
|
||||
0 move to first character
|
||||
: ex command
|
||||
; repeat last F, f, T or t search
|
||||
< shift lines left to motion
|
||||
> shift lines right to motion
|
||||
? search backward
|
||||
@ execute buffer
|
||||
A append to the line
|
||||
B move back bigword
|
||||
C change to end-of-line
|
||||
D delete to end-of-line
|
||||
E move to end of bigword
|
||||
F character in line backward search
|
||||
G move to line
|
||||
H move to count lines from screen top
|
||||
I insert before first nonblank
|
||||
J join lines
|
||||
L move to screen bottom
|
||||
M move to screen middle
|
||||
N reverse last search
|
||||
O insert above line
|
||||
P insert before cursor from buffer
|
||||
Q switch to ex mode
|
||||
R replace characters
|
||||
S substitute for the line(s)
|
||||
T before character in line backward search
|
||||
U Restore the current line
|
||||
W move to next bigword
|
||||
X delete character before cursor
|
||||
Y copy line
|
||||
ZZ save file and exit
|
||||
[[ move back section
|
||||
]] move forward section
|
||||
^ move to first non-blank
|
||||
_ move to first non-blank
|
||||
` move to mark
|
||||
a append after cursor
|
||||
b move back word
|
||||
c change to motion
|
||||
d delete to motion
|
||||
e move to end of word
|
||||
f character in line forward search
|
||||
h move left by columns
|
||||
i insert before cursor
|
||||
j move down by lines
|
||||
k move up by lines
|
||||
l move right by columns
|
||||
m set mark
|
||||
n repeat last search
|
||||
o append after line
|
||||
p insert after cursor from buffer
|
||||
r replace character
|
||||
s substitute character
|
||||
t before character in line forward search
|
||||
u undo last change
|
||||
w move to next word
|
||||
x delete character
|
||||
y copy text to motion into a cut buffer
|
||||
z reposition the screen
|
||||
{ move back paragraph
|
||||
| move to column
|
||||
} move forward paragraph
|
||||
~ reverse case
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
EX COMMANDS:
|
||||
^D: scroll lines
|
||||
!: filter lines through commands or run commands
|
||||
#: display numbered lines
|
||||
&: repeat the last subsitution
|
||||
*: execute a buffer
|
||||
<: shift lines left
|
||||
=: display line number
|
||||
>: shift lines right
|
||||
@: execute a buffer
|
||||
append: append input to a line
|
||||
abbreviate: specify an input abbreviation
|
||||
args: display file argument list
|
||||
bg: background the current screen
|
||||
change: change lines to input
|
||||
cd: change the current directory
|
||||
chdir: change the current directory
|
||||
copy: copy lines elsewhere in the file
|
||||
cscope: create a set of tags using a cscope command
|
||||
delete: delete lines from the file
|
||||
display: display buffers, screens or tags
|
||||
[Ee]dit: begin editing another file
|
||||
[Ee]x: begin editing another file
|
||||
exusage: display ex command usage statement
|
||||
file: display (and optionally set) file name
|
||||
fg: switch the current screen and a backgrounded screen
|
||||
global: execute a global command on lines matching an RE
|
||||
help: display help statement
|
||||
insert: insert input before a line
|
||||
join: join lines into a single line
|
||||
k: mark a line position
|
||||
list: display lines in an unambiguous form
|
||||
move: move lines elsewhere in the file
|
||||
mark: mark a line position
|
||||
map: map input or commands to one or more keys
|
||||
mkexrc: write a .exrc file
|
||||
[Nn]ext: edit (and optionally specify) the next file
|
||||
number: change display to number lines
|
||||
open: enter "open" mode (not implemented)
|
||||
print: display lines
|
||||
perl: run the perl interpreter with the command
|
||||
perldo: run the perl interpreter with the command, on each line
|
||||
preserve: preserve an edit session for recovery
|
||||
[Pp]revious: edit the previous file in the file argument list
|
||||
put: append a cut buffer to the line
|
||||
quit: exit ex/vi
|
||||
read: append input from a command or file to the line
|
||||
recover: recover a saved file
|
||||
resize: grow or shrink the current screen
|
||||
rewind: re-edit all the files in the file argument list
|
||||
s: substitute on lines matching an RE
|
||||
script: run a shell in a screen
|
||||
set: set options (use ":set all" to see all options)
|
||||
shell: suspend editing and run a shell
|
||||
source: read a file of ex commands
|
||||
stop: suspend the edit session
|
||||
suspend: suspend the edit session
|
||||
t: copy lines elsewhere in the file
|
||||
[Tt]ag: edit the file containing the tag
|
||||
tagnext: move to the next tag
|
||||
tagpop: return to the previous group of tags
|
||||
tagprev: move to the previous tag
|
||||
tagtop: discard all tags
|
||||
tcl: run the tcl interpreter with the command
|
||||
undo: undo the most recent change
|
||||
unabbreviate: delete an abbreviation
|
||||
unmap: delete an input or command map
|
||||
v: execute a global command on lines NOT matching an RE
|
||||
version: display the program version information
|
||||
visual: enter visual (vi) mode from ex mode
|
||||
[Vv]isual: edit another file (from vi mode only)
|
||||
viusage: display vi key usage statement
|
||||
write: write the file
|
||||
wn: write the file and switch to the next file
|
||||
wq: write the file and exit
|
||||
xit: exit
|
||||
yank: copy lines to a cut buffer
|
||||
z: display different screens of the file
|
||||
~: replace previous RE with previous replacement string,
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Edit options:
|
||||
noaltwerase filec="" nomodeline scroll=17 notildeop
|
||||
autoindent flash msgcat="./" nosearchincr timeout
|
||||
autoprint hardtabs=0 noprint="" nosecure nottywerase
|
||||
noautowrite noiclower nonumber shiftwidth=8 noverbose
|
||||
backup="" noignorecase nooctal noshowmatch warn
|
||||
nobeautify keytime=6 open noshowmode window=35
|
||||
cedit="" noleftright optimize sidescroll=16 nowindowname
|
||||
columns=80 lines=36 print="" noslowopen wraplen=0
|
||||
comment nolisp prompt nosourceany wrapmargin=0
|
||||
noedcompatible nolist readonly tabstop=8 wrapscan
|
||||
escapetime=1 lock noredraw taglength=0 nowriteany
|
||||
noerrorbells magic remap tags="tags"
|
||||
exrc matchtime=7 report=5 term="xterm"
|
||||
noextended mesg ruler noterse
|
||||
cdpath="/usr/src/local/nvi:/tmp"
|
||||
directory="/tmp"
|
||||
matchchars="[]{}()<>"
|
||||
paragraphs="IPLPPPQPP LIpplpipbp"
|
||||
recdir="/var/tmp/vi.recover"
|
||||
sections="NHSHH HUnhsh"
|
||||
shell="/bin/csh"
|
||||
shellmeta="~{[*?$`'"\"
|
||||
@@ -0,0 +1,12 @@
|
||||
# $NetBSD: Makefile,v 1.2 2008/12/09 23:49:42 lukem Exp $
|
||||
|
||||
.include "${.CURDIR}/../../Makefile.inc"
|
||||
|
||||
.PATH: ${DIST}/docs/vi.ref
|
||||
|
||||
TEXINFO= vi.texi
|
||||
INFOFLAGS= -I${DIST}/doc
|
||||
|
||||
vi.info: ref.texi vi.cmd.texi ex.cmd.texi set.opt.texi
|
||||
|
||||
.include <bsd.info.mk>
|
||||
@@ -0,0 +1,88 @@
|
||||
# @(#)autowrite 8.3 (Berkeley) 2/17/95
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,32 @@
|
||||
# @(#)context 8.6 (Berkeley) 10/14/94
|
||||
|
||||
In historic vi, the previous context mark was always set:
|
||||
|
||||
ex address:
|
||||
any number, <question-mark>, <slash>, <dollar-sign>,
|
||||
<single-quote>, <backslash>
|
||||
|
||||
ex commands: undo, "z.", global, v
|
||||
|
||||
vi commands: (, ), {, }, %, [[, ]], ^]
|
||||
|
||||
nvi adds the vi command ^T to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line changed:
|
||||
|
||||
vi commands: '<mark>, G, H, L, M, z
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line or column changed:
|
||||
|
||||
vi commands: `<mark>, /, ?, N, n
|
||||
|
||||
nvi adds the vi command ^A to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set in non-visual
|
||||
mode for ^R and ^L if the line changed, but I have yet to figure
|
||||
out how the line could change.
|
||||
@@ -0,0 +1,76 @@
|
||||
# @(#)gdb.script 8.5 (Berkeley) 5/4/96
|
||||
|
||||
# display the VI screen map
|
||||
# usage dmap(sp)
|
||||
define dmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($h <= $t)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$h->lno, (int)$h->soff, (int)$h->coff
|
||||
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 VI screen map
|
||||
define tmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($t >= $h)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$t->lno, (int)$t->soff, (int)$t->coff
|
||||
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 private structures
|
||||
define clp
|
||||
print *((CL_PRIVATE *)sp->gp->cl_private)
|
||||
end
|
||||
define vip
|
||||
print *((VI_PRIVATE *)sp->vi_private)
|
||||
end
|
||||
define exp
|
||||
print *((EX_PRIVATE *)sp->ex_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
|
||||
@@ -0,0 +1,350 @@
|
||||
# @(#)input 5.5 (Berkeley) 7/2/94
|
||||
|
||||
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 <newline> 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.
|
||||
7: Characters in executable buffers are remapped.
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
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 <newline> 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.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
7: Characters in executable buffers are remapped.
|
||||
|
||||
=== test file ===
|
||||
abcdefghijklmnnop
|
||||
ggg
|
||||
=== end test file ===
|
||||
|
||||
:map g x
|
||||
2G"ay$1G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
defghijklmnnop
|
||||
ggg
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
=== test file ===
|
||||
iFOO^[
|
||||
|
||||
=== end test file ===
|
||||
|
||||
1G"ay$2G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
iFOO^[
|
||||
FOO
|
||||
=== end output file ===
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
@@ -0,0 +1,36 @@
|
||||
@(#)openmode 8.1 (Berkeley) 10/29/94
|
||||
|
||||
Open mode has the following special behaviors:
|
||||
|
||||
z, ^F, ^B:
|
||||
If count is not specified, it shall default to the window
|
||||
edit option - 2.
|
||||
|
||||
Write lines from the edit buffer starting at:
|
||||
|
||||
(the current line) - ((count - 2) / 2)
|
||||
|
||||
until:
|
||||
|
||||
(((count + 1) / 2) * 2) - 1
|
||||
|
||||
lines, or the last line in the edit buffer has been written. A
|
||||
line consisting of the smaller of the number of columns in the
|
||||
display divided by two or 40 ``-'' characters shall be written
|
||||
immediately before and after the specified is written. These two
|
||||
lines shall count against the total number of lines to be written.
|
||||
A blank line shall be written after the last line is written.
|
||||
|
||||
z, ^F and ^B all behave identically.
|
||||
|
||||
^D: Display the next scroll value lines, change the current line.
|
||||
|
||||
^U: Change the current line, do nothing else.
|
||||
|
||||
^E, ^Y: Do nothing.
|
||||
|
||||
^L: Clear the screen and redisplay the current line.
|
||||
|
||||
H, L, M:
|
||||
Move to the first nonblank of the current line and do nothing
|
||||
else.
|
||||
@@ -0,0 +1,208 @@
|
||||
# @(#)quoting 5.5 (Berkeley) 11/12/94
|
||||
|
||||
QUOTING IN EX/VI:
|
||||
|
||||
There are four escape characters in historic ex/vi:
|
||||
|
||||
\ (backslashes)
|
||||
^V
|
||||
^Q (assuming it wasn't used for IXON/IXOFF)
|
||||
The terminal literal next character.
|
||||
|
||||
Vi did not use the lnext character, it always used ^V (or ^Q).
|
||||
^V and ^Q were equivalent in all cases for vi.
|
||||
|
||||
There are four different areas in ex/vi where escaping characters
|
||||
is interesting:
|
||||
|
||||
1: In vi text input mode.
|
||||
2: In vi command mode.
|
||||
3: In ex command and text input modes.
|
||||
4: In the ex commands themselves.
|
||||
|
||||
1: Vi text input mode (a, i, o, :colon commands, etc.):
|
||||
|
||||
The set of characters that users might want to escape are as follows.
|
||||
As ^L and ^Z were not special in input mode, they are not listed.
|
||||
|
||||
carriage return (^M)
|
||||
escape (^[)
|
||||
autoindents (^D, 0, ^, ^T)
|
||||
erase (^H)
|
||||
word erase (^W)
|
||||
line erase (^U)
|
||||
newline (^J) (not historic practice)
|
||||
|
||||
Historic practice was that ^V was the only way to escape any
|
||||
of these characters, and that whatever character followed
|
||||
the ^V was taken literally, e.g. ^V^V is a single ^V. I
|
||||
don't see any strong reason to make it possible to escape
|
||||
^J, so I'm going to leave that alone.
|
||||
|
||||
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.
|
||||
|
||||
Abbreviations were not performed if the non-word character
|
||||
that triggered the abbreviation was escaped by a ^V. Input
|
||||
maps were not triggered if any part of the map was escaped
|
||||
by a ^V.
|
||||
|
||||
The historic vi implementation for the 'r' command requires
|
||||
two leading ^V's to replace a character with a literal
|
||||
character. This is obviously a bug, and should be fixed.
|
||||
|
||||
2: Vi command mode
|
||||
|
||||
Command maps were not triggered if the second or later
|
||||
character of a map was escaped by a ^V.
|
||||
|
||||
The obvious extension is that ^V should keep the next command
|
||||
character from being mapped, so you can do ":map x xxx" and
|
||||
then enter ^Vx to delete a single character.
|
||||
|
||||
3: Ex command and text input modes.
|
||||
|
||||
As ex ran in canonical mode, there was little work that it
|
||||
needed to do for quoting. The notable differences between
|
||||
ex and vi are that it was possible to escape a <newline> in
|
||||
the ex command and text input modes, and ex used the "literal
|
||||
next" character, not control-V/control-Q.
|
||||
|
||||
4: The ex commands:
|
||||
|
||||
Ex commands are delimited by '|' or newline characters.
|
||||
Within the commands, whitespace characters delimit the
|
||||
arguments. Backslash will generally escape any following
|
||||
character. In the abbreviate, unabbreviate, map and unmap
|
||||
commands, control-V escapes the next character, instead.
|
||||
|
||||
This is historic behavior in vi, although there are special
|
||||
cases where it's impossible to escape a character, generally
|
||||
a whitespace character.
|
||||
|
||||
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)
|
||||
|
||||
Since file names are also subject to word expansion, the
|
||||
underlying shell had better be doing the correct backslash
|
||||
escaping. This is NOT historic behavior in vi, making it
|
||||
impossible to insert a whitespace, newline or carriage return
|
||||
character into a file name.
|
||||
|
||||
4: Escaping characters in non-file arguments in ex commands:
|
||||
|
||||
:abbreviate word string (word, string)
|
||||
* :edit [+cmd] [file] (+cmd)
|
||||
* :ex [+cmd] [file] (+cmd)
|
||||
:map word string (word, string)
|
||||
* :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.
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# @(#)structures 5.4 (Berkeley) 10/4/95
|
||||
|
||||
There are three major data structures in this package, plus a single data
|
||||
structure per screen type. The first is a single global structure (GS)
|
||||
which contains information common to all files and screens. It hold
|
||||
global things like the input key queues, and functions as a single place
|
||||
to hang things. For example, interrupt routines have to be able to find
|
||||
screen structures, and they can only do this if they have a starting
|
||||
point. The number of globals in nvi is dependent on the screen type, but
|
||||
every screen type will have at least one global, __global_list, which
|
||||
references the GS structure.
|
||||
|
||||
The GS structure contains linked lists of screen (SCR) structures.
|
||||
Each SCR structure normally references a file (EXF) structure.
|
||||
|
||||
The GS 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 never goes away. The SCR structure persists over
|
||||
instances of screens, and the EXF structure persists over references to
|
||||
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, which usually
|
||||
references an underlying EXF structure. 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 various ex commands will substitute a new EXF in place of the current
|
||||
one, and there's no way to detect this.
|
||||
|
||||
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.
|
||||
|
||||
CL The curses screen private data structure. Everything to
|
||||
do standalone curses screens.
|
||||
|
||||
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.
|
||||
|
||||
TK The Tcl/Tk screen private data structure. Everything to
|
||||
do standalone Tcl/Tk screens.
|
||||
|
||||
EXCMD In nvi/ex/ex.h. 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.)
|
||||
|
||||
VICMD In nvi/vi/vi.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.)
|
||||
Reference in New Issue
Block a user