AUTHOR AND VERSION.
P I E d i t o r f o r U n i x
by
G.B. Gustafson
Copyright 1985--2006
Version 24 September 2006
AUTHOR ADDRESS.
Regular and electronic mail can be used for communications. The GNU
Public License applies (see below). This software is not a product of
the University of Utah. There is NO WARRANTY.
Prof. Grant B. Gustafson
Math. Dept. Univ. Utah Rm233
155 South 1400 East
Salt Lake City, UT 84112-0090
ggustaf
math utah edu [24 Sep 2006]
GNU PUBLIC LICENSE.
This editor is released as copyrighted material under the GNU PUBLIC
LICENSE:
NO WARRANTY
Because PI is licensed free of charge, absolutely no warranty is
provided, to the extent permitted by applicable state law. Except
when otherwise stated in writing, Grant B. Gustafson provides PI "as
is" without warranty of any kind, either expressed or implied,
including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. The entire
risk as to the quality and performance of the program is with you.
Should the PI program prove defective, you assume the cost of all
necessary servicing, repair or correction.
In no event unless required by applicable law will Grant B. Gustafson
and/or any other party who may modify and redistribute PI be liable
to you for damages, including any lost profits, lost monies, or other
special, incidental or consequential damages arising out of the use
or inability to use (including but not limited to loss of data or
data being rendered inaccurate or losses sustained by third parties
or a failure of the program to operate with programs not distributed
by Grant B. Gustafson) the program, even if you have been advised of
the possibility of such damages, or for any claim by any other party.
NO COST?
This editor is provided free of charge to individuals and educational
institutions. Money is not requested.
WHY USE PI?
Unix editors are in abundance: ed, vi, emacs, jove. The complexity of
these Unix editors has increased over the years. Significantly, the
time required to learn each editor has also increased.
PI is made in the spirit of "simple" microcomputer editors. The
nucleus of keys required to run PI is very small: the arrow keys,
delete key, return and tab, menu key. Any editor function can be
selected from the pull-down menu. Memorization of accelerator keys is
not required.
There are some special features of PI that make it appealing:
MATRIX TEXT CURSOR. The text cursor moves independently of the
text to any row or column. Especially, the text cursor will move
beyond end of line and beyond end of file. This mode duplicates
what can be done by hand with paper and pencil.
LINE-BASED COPY, CUT and PASTE. To copy a collection of adjacent
lines, press F9 on each line, starting at the first and ending
with the last. This collects a copy of the block. Move the
cursor and press F10 to paste the block. It works like the
mouse, without dexterity problems.
VISUAL BLOCK. To de-mystify the mechanics of block operations, a
NotePad file collects all block text, where it can be viewed and
edited. An example for its use is to collect boilerplate text
from old letters, then finally paste the located snips into a
file.
MATRIX BLOCK. Solid rectangles of text with blank fill on the
right can be copied and pasted. No mouse work required.
LIVING CALCULATOR. An example: a TeX document has examples
labeled 1 to 45, but 4 have been deleted. With the integer
calculator, the examples are renumbered from 1 to 41. There are
three distinct calculators available: integer, floating-point
and scientific.
FOREIGN KEYBOARD. Entering text in foreign languages like
French, Slovak, Czech, German, Spanish, Finnish can use a
"foreign cycle table" in addition to native system keyboard
remaps. This system makes it possible to keep one keyboard
definition but still enter foreign text efficiently.
LINE NUMBERS. The cursor position on the screen and the current
line number are displayed (defeatable). There is a "GOTO LINE
NUMBER" on startup and also on menu "Edit".
CUSTOMIZATION. It is easy to add items on the menu and to bind
actions to keys or menu items.
DOCUMENTATION. There are three distinct kinds of online
documents which can be used during editing: plain text, html
browser and a quick reference.
LARGE FILES. Most MS-Windows and unix systems can read a 32mb
file successfully in under a second.
FAST SEARCH. Modern systems can look through a 32mb file in
under one-tenth of a second.
ATOMIC JUSTIFICATION. Paragraphs or portions thereof are
justified left with ragged-right by an atomic command that acts
on the current line, borrowing from the next line to fill text.
This method is practical for everyday use.
BASIC KEYS.
Highest Frequency: Up, Down, Left, Right, Page Ahead, Page Back,
Scroll Ahead, Scroll Back, Return, Tab, Reverse Tab, Edge Left, Edge
Right, Edge Top, Edge Bottom, Top of File, End of File, Delete Right,
Delete Left.
The majority appear on menus, so it is not necessary to learn them
all at once. Function keys and keypad functions do all but a few of
these operations. See "Keymap editor" for a complete description of
each function and the keys mapped to it.
KEYMAP EDITOR
To display the key assignments for basic keys, press the MENU key
(see below or press ESC four times) and move with cursor keys to
"KEYS". Highlight the entry "Keymap editor" and press RETURN.
Move to the basic key with the arrow keys and read the key assignment
from the status line. A typical status line looks like this:
Keymap:^R:{PgUp}
The symbolc ^R means ctrl-R and {PgUp} is a second key on the
keyboard assigned to the same function. Multiple keys can be assigned
to a function. The keymap editor handles adds and deletes of keys.
In verbose mode, the status line will appear instead as
[PAGEBACK]{1020} Keymap:^R:{PgUp}
The [PAGEBACK] on the left is the source code symbol used by the
compiler and {1020} is the translation to an integer, which can be
used to assign a key to function "PAGEBACK". The information is only
useful for debugging the keymap.
To remove the key PgUp from "PAGEBACK" and add the key sequence ALT-p
in its place,
o Press MINUS (-) and then the key PgUp to delete the key.
o Press PLUS (+) and the the key Alt-p to add the key.
WARNING: key deletes apply to the current line in the keymap editor.
A log of the delete appears in PI.SET, in case you need to undo a
mistake.
The changes are inserted into the file PI.SET in the current
directory, or else in the system file PI.SET. You can edit that file
manually to inspect or delete automatically generated lines. To undo
a line in PI.SET, insert a comment character # or ; in column 1.
SHOW KEYPRESS. From the "Keys" menu select "Show keypress."
Alternatively, start the "Keymap editor" and press "S". The status
line will show any key pressed in raw termcap codes. Use RETURN to
exit. Use BACKSPACE to erase keys that have been displayed. Most
function keys will emit codes that can be inserted into the text by
pressing ctrl-P first. The "escapes" in termcap code are as follows:
Termcap C language Name
\e '\033' ESCAPE
\E '\033' ESCAPE
\b '\b' BACKSPACE
\f '\f' FORMFEED
\n '\n' LINEFEED
\r '\r' RETURN
\t '\t' TAB
^X 'X'-'@' Ctrl-X
TERMCAP KEY CODES RULES. The status line coding follows TERMCAP
rules: ^R means Ctrl-R, \E means ESCAPE. Function keys like F1 appear
on the status line as {F1}. The arrow keys are labeled {UP}, {LEFT},
{RIGHT}, {DOWN}. Other special key labels are {INS}, {DEL},
{BACKSPACE}, {HOME}, {END}, {PGUP}, {PGDN}, {ENTER}.
NAVIGATION. The keys available for navigation in the list are up and
down arrow keys. The SPACE key exits. A PERIOD key (.) executes the
command. Other keys are taken as a request to move the cursor to the
matching text. This includes function keys and multiple key
combinations like ctrl-K,ctrl-S (save file). Ordinary characters
match upper case letters and cause a search to begin, eg, "c" matches
"Cursor", "Center" and "Copy".
LEADIN CHARACTERS. The editor uses internally a string named
"LeadinSTR" which contains all lead-in characters used in the current
keymap. These characters are obtained by copying the first character
from each nonzero keymap string. The string "LeadinSTR" is written
into file "pi-macro.key", so you can look at it if you are
interested. A leadin character causes the key routine in PI to abort
passing the key as an insert. Instead, PI decodes the character as
the first character of a keymap string. There can be a delay until
enough characters are keyed in to identify a valid keymap string or
to abort the decoding. Each time you add a key to the keymap, a sort
of the keymap strings occurs followed by re-definition of LeadinSTR.
Keymaps that don't work can often be traced to defining a string that
cannot be found by searching. The rules:
1. Existing keymaps determine the lead-in strings. Searchs for a
keymap match must wait for additional characters to be typed, if
what has already been typed matches a lead-in string.
2. Two keymaps may have the same initial characters. But if they
do, then the matching initial characters must in each case be
followed by one or more additional characters that distinguish
the two strings.
Because a multiplicity of keys are already defined, conflicts can
easily occur. A common conflict is to take an already defined keymap
like "^B" and try to add one more character to make a distinct
keymap, e.g., "^B^X". This violates item 2 above. The result: typing
"^B" will cause no action, while PI waits for the second character,
because of item 1. The effect of adding "^B"X" is to disable the
length one keymap "^B" - it is lost forever.
Another example: to allow function keys with escape ("\E") leadin, an
extra character has to be added to each keymap string that begins
with "\E". For instance, "\E\E" will work as a keymap string but "\E"
by itself will not, as its leadin character conflicts with other
strings that have leadin "\E".
MOUSE USAGE.
X-WINDOWS and unix.
On unix hosts with Xterm or X-window Rxvt support there is
positioning of the cursor plus basic copy and paste.
Poorly documented in Xterm and Rxvt is how to make positioning and
copy/paste work together. Briefly, left mouse click will position the
cursor. The copy and paste functions require that SHIFT (also ALT for
rxvt) be pressed during these operations.
The keymaps of RXVT can be forced upon Xterm and NXterm by adding
VT100 overrides to the file $HOME/.Xdefaults or to the system XTerm
application default.
CYGWIN MS-Windows.
Console mode cygwin PI runs in either the standard (black) bash
console or in an rxvt console, which runs without X-windows. The
latter is more useful because of mouse, font and color support plus
resizing and a history scrollbar. A warning: most MSDOS programs
don't run in rxvt, but they do run in a standard bash console. So you
need to have a mouse button to activate both kinds of consoles.
MS-WINDOWS.
The lcc compiler is used to make a console-based PI that runs under
versions of MS-Windows since 1996. Only win 3.1 fails to work; use
MSDOS PI instead. This version of PI is fully functional and perhaps
the most mature of all the versions.
MSDOS.
Under MS-DOS with internal mouse support (a compile option; see
v14.c), mouse motion moves the cursor with scrolling in all four
directions. The left mouse button is RETURN and the right mouse
button is ESC (double-click right for the menu). If using MS-Windows,
then this option has limited use, because in order to use it and
windows copy/paste there has to be switching from full-screen to
windows mode. The compiled option can be disabled in PI.SET by
setting the mouse sensitivity variables equal to zero.
Under MS-DOS with external TSR xpcmouse.exe, there is copy and paste
relative to the visible screen plus cursor positioning. The clipboard
for this TSR is available in all DOS programs that don't capture the
mouse for their own use, even in MS-Windows. This interface works
with MS-Windows provided PI is primarily used in full-screen mode.
Then positioning, copy and paste appear to work normally. Under
certain setup conditions, namely EXCLUSIVE MOUSE MODE, it also works
in a DOS window, replacing for practical purposes the windows
copy/paste operations. The EXCULSIVE MODE interface is a lot of
trouble, since the expected Windows mouse copy/paste are disabled. It
is best to leave them enabled, then when positioning features are
required with the mouse, switch to full-screen mode, and back again
as needed. The combination SHIFT-ALT-BUTTON1 will copy the xpcmouse
buffer to the windows clipboard. It is possible to switch from
full-screen to window mode and bring data into windows applications.
Under MS-Windows 95/98/2000, the mouse interface for a DOS window is
easy to use and well-documented. To make PI easier to use in this
system, compile it without mouse support (the default). If later it
is decided to use mouse support, then xpcmouse can provide what is
required.
FILE FORMAT.
The basic file format is TEXT. Standard text files are used by
compilers, email programs, LaTeX and TeX programs, DOS or Unix
programs and utilities.
Foreign language text files can be created and edited, files that use
the extended ASCII codes 129-254 in addition to usual characters. All
of the MSDOS code pages are supported, so that a foreign language
keyboard and display can be matched. Unix support under X is limited
to available fonts. Favorite fonts are VGA for a DOS-style window and
some of the special code-page unix fonts that simulate what is
available under MS-windows. Lacking the exact code page font can be
problematic, the only cure being to substitute an available one and
live with it.
Text files from Apple MacIntosh, Microsoft MSDOS, Unix can be
imported or exported. Other file conversions are possible, for
example, WordStar to ASCII and other word processors that set the
eighth character bit.
Word processor formats are not supported except as imported binary.
KEY STANDARD.
This editor supports three major keyboard standards: Emacs, WordStar
and WordPerfect. Wordstar is the default, although a better keyword
might be "Borland" or "Microsoft NotePad".
As an emacs clone, PI places the majority of functions on menus and
implements only a critical mass of keyboard functions: cursor moves,
block marking, line and word deletes.
As a Wordstar-style editor, PI is similar to Microsoft Edit and
Borland International's Turbo products.
There is at present no VI support. It is possible to add it, but
there has been zero demand for the feature.
PI used to run on these hosts: IBM PC, DEC-20/60, VAX 8600, SUN3,
SUN4, SUN386i, Stardent-Titan, DEC 3100, DEC 5000, DEC ALPHA, IBM AIX
(R6000 and 3790), SGI-Indigo. In the year 2000, the number of
different machines has been reduced to a small list: MSDOS, Win3.1
to WindowsXP, unix offered by IBM, DEC and SUN, and Linux on PC
hardware. There is no Apple Finder support, but macOSX is supported.
TERMINAL.
Unix PI attempts to use system environment variables TERM and TERMCAP
to get terminal information. If these variables are unset, then PI
will assume terminal type VT100 and ask for confirmation, or ctrl-C
to abort. For a list of all supported unix terminals, execute the
unix shell command $PIE/tcapnames. Not finding a suitable terminal
from this list means that the file /etc/termcap has to be edited.
If termcap does not exist, but xterm exists, then the terminal type
can be set to "-term:vt100internal" and everything will work.
Under MSDOS and MS-Windows, the terminal type is not used. The
assumed terminal is a 100% IBM compatible machine either monochrome
or color. The editor operates in high resolution text mode with
direct screen writes to segment address B000 or B800.
The only special MSDOS feature available is the video snow limiter
code which applies only to older pre-1995 CGA adaptors. The snow
limiter enable is set in resource file PI.SET. See SETUP below.
KEYBOARD.
The keyboard map is initially Wordstar keys plus function keys that
do not follow any special standard. The Keymap editor can change the
mapping based upon the installed keyboard itself, so expect to
customize PI to your system.
These remarks apply to Unix or VMS. Automatic default key set depends
upon the terminal. The only real support these days is vt100, so that
is what exists, although the code in PI will accept others which have
a termcap entry, notably unix systems with xterm and MS-windows
systems with cygwin.
If the terminal does not match a known type, then a basic Wordstar
key assignment will be used and vt100 is assumed.
SETUP.
Under Unix, editor defaults like insert mode on/off can be set in the
resource file `~/.pirc' in your home directory. This file is supplied
automatically by PI: it copies `$PIE/SYSpi.rc' to the file
`$HOME/.pirc' to give you a private copy.
Under MS-DOS, the file name for editor defaults is PI.SET located in
the same directory as PI.EXE. The latter is expected to be in the
PATH set for MSDOS or the default connected directory. The location
can be changed from the default by using the environment variable
PIEINIT. See below.
Also expected in the same MSDOS directory as PI.EXE are PI.DAT and
PI.SET. The file PI.DAT is used to give key mapping reports. The file
PI.SET sets keys and serves as a way to load commonly used macros and
key definitions. If these files are not present, then the built-in
defaults apply. Notably, the keymap editor will not work.
Under Unix, the file names PI.SET and PI.DAT become ~/.pirc and
keymap.dat, respectively. Again, the setup files are expected to be
in the same directory as the executable.
LOCAL SETUP.
The file PI.SET under MSDOS can be copied to a local directory and
changed to effect changes that appropriate for that subdirectory. For
example, in one directory it may be appropriate to enable word wrap
but not in general. The local file PI.SET is read instead of the
global PI.SET.
The same advice applies under unix with the file ".pirc". If it is
present in a subdirectory, then it will be read on startup to reset
any global settings. In that system, it is impossible to get along
without the setup file ~/.pirc, because of read/write permissions on
the global setup files.
Macro keys and re-definitions of keys can be loaded automatically by
placing the file PI-MACRO.KEY in the subdirectory where the
automation is desired. Generally, this is a hack, and it is better to
place a copy of ~/.pirc in the subdirectory, then launch PI from that
location. The advantage is that macro definitions special to the
subdirectory are saved in ./.pirc instead of in ~/.pirc, a better
option for working on a project. The file pi-macro.key is a cheap
method for moving such macros to a new location, without copying the
entire setup file ./.pirc.
NORMAL START.
It is enough to type the name `pi'. If you want to edit an existing
file called MYFILE, then type `pi MYFILE' instead. See below for
other command line options.
COMMAND LINE OPTIONS.
The complete syntax is:
pi -dir:D -set:X -term:Y -key:Z -x -m FILE -gN
where each switch is described below.
-dir:D Use directory D for support files
Example: pi -dir:/usr/local/lib/pie/wdstar/
-set:X Use setup file X
Example: pi -set:/u/vi/peoples/.pirc
-term:Y Select terminal type Y
Example: pi -term:vt100
Example: pi -term:vt100internal
-key:Z Use key map file Z
Example: pi -key:$HOME/pi-dump.key
-x Special setup for PI running in an xterm window
Example: xterm -fn vga -geometry 80x25 -e pi -x &
Window properties can be set to customize colors,
fonts, scrollbars and borders.
-m Setup for unix workstation mouse under xterm window.
Normal xterm mouse clicks set the cursor. Cut and paste
require SHIFT to be depressed. See rxvt remarks below.
The X-windows mouse toggle "xmouse.toggle=1" in the
setup file .pirc does the same thing, but this command
line switch over-rides the setting in .pirc.
FILE A wildcard file list separated by spaces
Example: pi paper.tex p*.bib intro.???
-gN Go to line number N after file load
Example: pi paper.tex -g4872
The MS-DOS version ignores switches -x, -m and -term. There are
versions of PI for DOS/Windows machines that need to set the
terminal. To that version please apply all remarks for the Unix
version.
The -x switch applies to X-term windows that have no shell for exit.
It disables a shell exit (prudent if there is no shell). The -g
switch applies to the file name immediately preceding. One -g switch
can be given for each file.
Abbreviations are possible, e.g., "pi -s:X -t:Y -k:Z FILES".
More than one -set: and -key: may be supplied.
ENVIRONMENT VARIABLES.
The environment variable PIEINIT is used to shorten the command line
syntax or to provide a default. The statement
setenv PIEINIT '-set:X -term:Y -key:Z'
causes PI to reset its initial options. Subsequent command line
switches cause the defaults to be ignored.
Under MS-DOS the environment setup usually takes the form
set PIEINIT=-set:X -key:Z
SETTERM.
A preferred way to set TERM and TERMCAP under Unix for a vt100
terminal is by using the command
set noglob
eval `tset -Q -s vt100`
set term="$TERM"
unset noglob
XTERM and NXTERM.
A usual setup in $HOME/.Xdefaults for Xterm, NXterm and Rxvt is the
following. The last two iterms are likely ignored by Rxvt, but
important for Xterm, in order to keep a useful set of keymaps. If Sun
function keys are added, then the very last line will have almost no
effect on Xterm keymaps. Most attempts to add "xterm.geometry" have
failed, so it is left out (it has caused the Xterm menus to vanish,
without effecting any useful change to the geometry).
xterm*background: Yellow
xterm*foreground: Black
xterm*cursorColor: Red
xterm*charClass: 33:48,37:48,45-47:48,64:48
xterm*font: fixed
xterm*fullCursor: true
xterm*scrollBar: true
xterm*rightScrollBar: true
*eightBitInput: false
xterm*oldXtermFKeys: true
The useful keymap features of RXVT can be added to Xterm and Nxterm
once and for all by adding some text to $HOME/.Xdefaults, namely, the
Xterm.ad file distributed with RXVT. If you use both RXVT and XTERM,
then this is recommended, so that applications can have the same
keystrokes in both terminal programs. The text from a 1999 RXVT
distribution for Linux:
XTerm*vt100.translations: #override \
! [Key]BackSpace: string("\010") \n\
Shift[Key]Tab: string("\033[Z") \n\
Ctrl[Key]minus: string("\037") \n\
[Key]Home: string("\033[1~") \n\
[Key]End: string("\033[4~") \n\
[Key]Delete: string("\033[3~") \n\
Shift[Key]Delete: string("\177") \n\
Ctrl[Key]Delete: string("\010") \n\
Alt[Key]Return: string("\033\015") \n\
Alt[Key]space: string("\033\040") \n\
Alt[Key]a: string("\033a") \n\
Alt[Key]b: string("\033b") \n\
Alt[Key]c: string("\033c") \n\
Alt[Key]d: string("\033d") \n\
Alt[Key]e: string("\033e") \n\
Alt[Key]f: string("\033f") \n\
Alt[Key]g: string("\033g") \n\
Alt[Key]h: string("\033h") \n\
Alt[Key]i: string("\033i") \n\
Alt[Key]j: string("\033j") \n\
Alt[Key]k: string("\033k") \n\
Alt[Key]l: string("\033l") \n\
Alt[Key]m: string("\033m") \n\
Alt[Key]n: string("\033n") \n\
Alt[Key]o: string("\033o") \n\
Alt[Key]p: string("\033p") \n\
Alt[Key]q: string("\033q") \n\
Alt[Key]r: string("\033r") \n\
Alt[Key]s: string("\033s") \n\
Alt[Key]t: string("\033t") \n\
Alt[Key]u: string("\033u") \n\
Alt[Key]v: string("\033v") \n\
Alt[Key]w: string("\033w") \n\
Alt[Key]x: string("\033x") \n\
Alt[Key]y: string("\033y") \n\
Alt[Key]z: string("\033z") \n\
Ctrl[Key]Up: string("\033Oa") \n\
Ctrl[Key]Down: string("\033Ob") \n\
Ctrl[Key]Right: string("\033Oc") \n\
Ctrl[Key]Left: string("\033Od") \n\
Shift[Key]Up: string("\033[a") \n\
Shift[Key]Down: string("\033[b") \n\
Shift[Key]Right: string("\033[c") \n\
Shift[Key]Left: string("\033[d") \n
[The above code uses square brackets around "Key" instead of the
correct angle brackets, so it will display correctly in html
displays. For insertion into $HOME/.Xdefaults, change the square
brackets to angle brackets.]
It is possible to extend this list usefully, by adding codes for
ALT-1 to ALT-9. This gives a longer list of handy macro keys to
assign. It is unclear whether you will need to fool with the
backspace key, so it is commented out above. Generally speaking,
all comment lines should be removed from the Translations.
Additional keys needed for macros in Xterm can be designed from the
RXVT documentation for the keymaps. To wit:
Normal Shift Control Ctrl+Shift
Tab ^I ESC [ Z ^I ESC [ Z
BackSpace ^H ^? ^? ^?
Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @
Insert ESC [ 2 ~ paste ESC [ 2 ^ ESC [ 2 @
Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @
Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @
Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @
Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @
Home ESC [ 7 ~ ESC [ 7 $ ESC [ 7 ^ ESC [ 7 @
End ESC [ 8 ~ ESC [ 8 $ ESC [ 8 ^ ESC [ 8 @
Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @
F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^
F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^
F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^
F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^
F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^
F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^
F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^
F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^
F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^
F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^
F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @
F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @
F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @
F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @
F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @
F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @
F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @
F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @
F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @
F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @
Application
Up ESC [ A ESC [ a ESC O a ESC O A
Down ESC [ B ESC [ b ESC O b ESC O B
Right ESC [ C ESC [ c ESC O c ESC O C
Left ESC [ D ESC [ d ESC O d ESC O D
KP_Enter ^M ESC O M
KP_F1 ESC O P ESC O P
KP_F2 ESC O Q ESC O Q
KP_F3 ESC O R ESC O R
KP_F4 ESC O S ESC O S
XK_KP_Multiply * ESC O j
XK_KP_Add + ESC O k
XK_KP_Separator , ESC O l
XK_KP_Subtract - ESC O m
XK_KP_Decimal . ESC O n
XK_KP_Divide / ESC O o
XK_KP_0 0 ESC O p
XK_KP_1 1 ESC O q
XK_KP_2 2 ESC O r
XK_KP_3 3 ESC O s
XK_KP_4 4 ESC O t
XK_KP_5 5 ESC O u
XK_KP_6 6 ESC O v
XK_KP_7 7 ESC O w
XK_KP_8 8 ESC O x
XK_KP_9 9 ESC O y
An example: Add to the Translations the text
[Key]F16: string("\033[29~") \n\
to invoke the effect of RXVT's F16 onto the menu key (F16), which is
next to the Windows95 key on a Win95 keyboard. Then pressing F16 in
Xterm will generate the string "\033[29~" which can then be used to
produce some useful key in applications that can recognize it.
Please note that translations are not available in RXVT, the feature
is only found in Xterm. The translation feature in Rxvt exists, but
it is done differently than in Xterm. Execute "man rxvt" for details.
RXVT.
The international xterm called "rxvt" is available for unix. It
allows transparency of 8-bit characters and the mouse can be used in
a useful way. However, edits to Xterm also allow 8-bit transparency,
so try it first, before thinking that rxvt is needed under your unix
installation. New distributions of Xterm tend to include all useful
ideas found in rxvt and therefore Xterm is the standard.
There is also (1998) an edit of Rxvt called "xiterm" which tries to
be a replacement for the older MIT Ixterm. Probably all features
worth anything in xiterm have already been placed into Rxvt and
Xterm.
One known problem with Rxvt (1999) is pasting of text from other X
applications. Sometimes it fails, eg, Xmaple mouse-copying sometimes
cannot be pasted into Rxvt, but it will indeed paste into Xterm,
while text copied in an Xterm window always seems to paste into Rxvt.
The latter is an Rxvt workaround: paste application text into Xterm
or Xclipboard and then copy it again for pasting into Rxvt. This
problem does not seem to exist for Netscape using its text-only
message editor. Other applications like Xfig and Gnuplot seem to be
free of problems. One could argue that the problem is Xmaple, except
that regular Xterm does not have a problem. Other work-arounds
include using Xclipboard, which for most applications is the most
reliable.
Other useful features of RXVT include a complete key mapping,
including ALT keys mapped as ESCAPE plus the character, e.g., ALT-x
maps to ESCAPE-x. The default for Xterm is the Meta key (Windows key
on 102 keyboards), different that the Alt key. See other references
herein to Xterm for a way to make Xterm and Rxvt have matching
keymaps, through $HOME/.Xdefaults.
The X-windows mouse can be used to position the cursor and/or copy
and paste text. To repeat, set "xmouse.toggle=1" in .pirc and press
the left mouse button to position the cursor, and press SHIFT plus
left mouse drag-and-release to copy text. To paste, press SHIFT and
then the right mouse button.
The advice given here for rxvt applies as well to xterm and nxterm.
It seems to always happen that some feature in one or more of these
terminal emulators is temporarily broken, so it is a good idea to
keep all of them running.
A NEW CONSOLE. The cygwin distribution for MS-windows includes a
specially compiled rxvt.exe that uses just two dll libraries:
libW11.dll and cygwin1.dll. Adding bash.exe completes the rxvt
package to give a terminal emulator in MS-windows that is resizeable
with settable font. The only negative is that you cannot run win32
apps inside it, only real MSDOS apps and cygwin apps, e.g., a program
compiled with lccwin32 as a console app that uses win32 calls won't
run correctly.
RUNTIME LIBRARIES. The cygwin package for PI uses these libraries:
C:\CYGWIN\BIN\CYGWIN1.DLL
C:\WINDOWS\SYSTEM\WSOCK32.DLL
C:\WINDOWS\SYSTEM\WS2_32.DLL
C:\WINDOWS\SYSTEM\MSVCRT.DLL
C:\WINDOWS\SYSTEM\WS2HELP.DLL
C:\WINDOWS\SYSTEM\WININET.DLL
C:\WINDOWS\SYSTEM\SHLWAPI.DLL
C:\WINDOWS\SYSTEM\MSWSOCK.DLL
C:\WINDOWS\SYSTEM\MSAFD.DLL
C:\WINDOWS\SYSTEM\USER.EXE
The lccwin32 package for PI uses just C:\WINDOWS\SYSTEM\CRTDLL.DLL. The
DOS package for PI uses no libraries.
MENU.
The menu system in PI lists the majority of functions that the editor
can perform. To highlight an editor function apply cursor keys (or
press the letter displayed in upper case in its name). The
highlighted function is executed by pressing SPACE or RETURN.
The menu design parallels the MAC interface. The difference is that
the key assignment appears on the status line. It is recommended that
you learn key combinations for menu items used often.
To activate the MENU use one of these combinations:
DEC: ENTER key on the application pad
IBM 101: Dark Asterisk (*)
IBM 101: Two Dark Plus keys
IBM 101: ENTER key on the application pad
IBM 101: F12
Ctrl-Underline
Two ESC keys
Four ESC keys
On a given keyboard, more than one combination might work. Choose the
one most convenient. The MENU key can be duplicated and changed - see
the section on keyboard reassignment below.
HOW TO USE THE ENTER KEY.
The ENTER KEY is a special key that places the editor temporarily
into a command mode. The actual key varies among implementations. It
may be a single key or a sequence of keys. You will know that it
works because the cursor moves to the status line and the prompt
`ENTER: ' appears.
Typical key assignments for the ENTER key are: (1) ESC-ESC, (2)
Keypad ENTER, (3) F12.
The idea behind the ENTER KEY is to reduce the number of keys
required by using postfix syntax. It is also useful for one-hand
typing of various commands.
In the command mode the expected input is:
NOTHING. The next key determines what happens as follows:
TERMINATING KEY RESULT
-----------------------------------------------------
Tab Reverse tab
Up Top of file
Down End of file
Paste line Paste notepad by line method
Kill to end of line Blank entire line.
Any search key Paste default search string
to status line.
Paste Paste last status line to
current status line.
A FILE NAME. The next key should be a file manipulation command
which can use the file name just entered. The possibilities
appear below:
TERMINATING KEY RESULT
-----------------------------------------------------
Open file Open file with supplied name
Save on disk Save as ... with supplied name
Close after save Save as ... with supplied name
Save as ... Save with supplied name
Exit after save Save with supplied name and exit
Inject file Inject file with supplied name
A SEARCH STRING. The next key should be a Forward search or
Backward search command. The action is the same as "New search"
without all the screen displays.
A NUMBER. The action taken on the next key is as follows:
TERMINATING KEY RESULT
-----------------------------------------------------
Page Up Cursor N pages forward
Page Down Cursor N pages back
Line ahead Cursor N lines forward
Line back Cursor N lines back
Copy line Add N lines to the notepad
Dup line onto notepad Add N lines to the notepad
Run macro Run macro N times
Kill line, add to notepad Delete N lines, add to notepad
Forward a window Forward N windows
GoTo line #. GoTo line number N
PASTE TEXT. The keys below copy text to the status line. They do
not terminate the status line input. The items are explained in
detail below.
KEY RESULT
----------------------------------------------------------
Any search key Paste default search string to status.
Note: Status must be empty.
Up arrow Paste a saved search string (50 saved).
Each uparrow recalls another search
string, until no more are left.
Dn arrow Back up in the saved search string list.
Stops at the default search string.
Paste directory Paste current buffer file name.
Tab Complete last token as a file name.
Backspace Paste token from screen to status.
BackTab Mung previous token as a unix file name.
Math key Replace status line by math result of the
line (considered a math problem) and
continue. There are several math keys.
See below, especially SciCalc.
To save a copy of a file name, launch the paste buffer prompt,
then use the "paste directory" key combination.
EDITING THE STATUS LINE.
The status line prompts that accept search strings, file names and
words or phrases can be edited. Besides the left arrow and delete key
there are some other special functions available, all of which have
important uses.
a. A SEARCH key (AHEAD or BACK) pastes the default search string.
This only happens if the line is blank.
b. A PASTE DIRECTORY key yanks in the current buffer name (i.e.,
path name) in host format. Works anywhere on the line.
c. The TAB key completes a file name. To enter a TAB itself press the
QUOTE key (normally ctrl-V or ctrl-P) and then TAB. The match
proceeds from the last token before the cursor and therefore can
be applied anywhere along the line.
If an exact match occurs, then the file name appears on the status
line. Otherwise, the name entered has wildcards added.
Entering // (also \\ for MSDOS) will erase the current file name
and replace it by / (or \ for MSDOS). This feature eliminates the
need to erase long directory names. Shortcut: press // and TAB to
reduce a long directory name to /.
d. The REVERSE TAB key mungs the last token on the line to Unix
format. Useful under MSDOS for building command lines for GNU
utilities and TeX programs like sbtex and emtex.
e. The PgUp key hit on an empty status line causes a cursor move to
the top of the file. Similarly, ENTER plus PgDn moves the cursor
to the end of the file.
f. The Left Arrow key and the delete key remove one character left.
The Right Arrow key copies text at the buffer cursor position to
the status line, one character per key press, with blank fill if
beyond end of line.
g. The up arrow key recalls past search strings, which replace the
current status line text. After 50 up arrows the process ends. The
down arrow key reverses this process, until the default search
string again appears on the status line.
h. Other plain text can be typed in to change the phrase on the
status line. The QUOTE key can be used to enter ASCII control
characters. On an IBM keyboard, to enter ASCII codes 129-255, hold
down ALT and type the code on the numeric pad.
i. Ctrl-BACKSPACE (Backspace under Unix) injects a token from the
text buffer at the cursor. The END key is a duplicate key. It can
be repeated to quickly copy part of a line. It does nothing if the
cursor is at or beyond the end of line. Good for grabbing file
names, labels and search tokens from the screen without using a
mouse, especially for math computations.
j. The text on the status line can be interpreted as a math problem,
to which one of the math keys can be applied, to replace the
status with the answer to the math problem.
IntMath Replace status text with the integer math result.
Example: Status "4+5" becomes "9"
Extra trash on the line stops translation.
HexToBase10 Replace status text by its translation from hex
to decimal (base 10).
Example: "0x34fe" and "34Fe" translate to "13566"
OctToBase10 Replace status text by its translation from octal
to decimal (base 10).
Example: "0344" and "\344" translate to "228"
FloatMath Replace status text by the float math result.
Example: Status "34.5+6" becomes "40.5"
Extra trash on the line stops translation.
SciCalc Replace status text by its calculator result.
Supports scientific calculator functions like
ln(x), sin(x) and parentheses. Supports named
variables. Syntax is not forgiving.
Extra trash on the line is a syntax error.
Try them out yourself. The key maps are defined on the WORD menu.
If "Fill phrase buffer" is chosen from the "WORD" menu, then the
answer is saved in the phrase buffer, so it can be later injected
into the text or recalled. The calculations work on the status
line always, but it may be difficult to use it there.
k. The PASTE key copies the last status line onto the current status
line. All characters already typed are lost. If nothing is typed,
then the "last status line" text is unchanged. Generally, this key
is F10.
If you type something onto the status and accidently hit RETURN,
then press ENTER again followed by F10 to get back everything.
I. The keys ctrl-K,C and ctrl-K,R pressed on the status line inject
the column and row position respectively, as strings. Primarily
used in keyboard macros. For example, xdvi search needs the
row:col position in its command line.
J. A number of editor function keys will cause immediate abort. The
most reliable abort is the menu key. The return key is accepted as
the end of input, meaning `go ahead, I did it right'. All abort
keys cause any typed text to be saved as "the last status line",
which is retrieved by F10 when the status line is active.
DELETING FILES FROM A PICK-LIST.
If a file list is presented in PI, then the DELETE LINE key (F4 or L4)
will mark a file for deletion. The INSERT LINE key (F3 or L3) will
unmark the file. Upon exit from the pick-list, a query appears on the
status line, for the actual deletion process. Each file is presented
and the following answers are expected:
Y Yes, delete the file or directory
N No, don't delete it
Q Quit, forget about all marked files
A All, delete all files and directories without asking
? Other responses mean N: don't delete it.
In particular, SPACE and RETURN mean N.
ENTER KEYS FOR TERMINALS.
The ENTER KEY is chosen from these possibilities:
ENTER on the application pad
ESC,ESC key sequence
Dark+ on IBM 101 keyboards
F12 on enhanced keyboards
The ENTER key is usually duplicated by many key combinations. For
example, on a Sun keyboard with any standard configuration, two ESC
keys or R1 invoke the ENTER key.
RETURN KEY AND LINEFEED KEY.
When INSERT is off, use RETURN to place the cursor on the left edge
of the next line. Repeat to adjust several lines.
When INSERT is on the function of RETURN changes depending upon the
method chosen in the initialization file PI.SET or ~/.pirc using the
setup value `return.insert.crlf'. The operation is as follows:
return.insert.crlf=0 No split line ever. Best typewriter emulator.
Same action as unix VI editor.
return.insert.crlf=1 Split line when INSERT is on. Emacs,
WordStar, WordPerfect.
The LINEFEED key ctrl-J can be used to replicate the function
described above for the return key in insert mode. It is a useful
combination to set `return.insert.crlf=0' in PI.SET and rely upon the
key ctrl-J (LINEFEED) to insert blank lines or split a line. About
half of the people using PI in Wordstar mode prefer this setup,
because unwanted RETURN keys are common.
In Emacs, Wordstar and WordPerfect emulation, the return key inserts
a new line.
In non-insert mode, the return key moves the cursor, but does not
insert text. The same is true of the TAB key in Wordstar and
Wordperfect modes.
Even in non-insert mode the action of the return key in insert mode
can be duplicated by ctrl-J (return is ctrl-M). This is used more
often at end of line than mid line. See below for how to set the
return key defaults.
TAB KEY AND REVERSE TAB KEY.
In non-insert mode the TAB key moves 8 columns at a time. An ENTER +
TAB moves in the reverse direction. The amount the TAB key moves can
be set: use the "VALUES" menu and apply "Tab and Margin". There are
also moves by word either left or right. These have been appended to
the table below because the functions provide a similar service.
The action of the TAB key is to insert spaces while reverse TAB
removes the spaces inserted by the TAB key. The state of insert mode
affects this rule: TAB and reverse TAB move the cursor when insert is
off, except for Emacs mode, where the state of insert does not affect
the action.
WordStar Emacs WordPerfect
-------------------------------------------------------------
ahead 8 columns Tab not used not used
back 8 columns shift-Tab not used not used
ahead one word ctrl-F ESC F ctrl-Right
back one word ctrl-A ESC B ctrl-Left
SHORT CURSOR MOVES.
Use the arrow keys for moves of a few characters. The normal
conventions are:
VT52/VT100 WordStar Emacs WordPerfect
---------------------------------------------------------
left arrow keypad 4 ctrl-S ctrl-B ctrl-X
right arrow keypad 6 ctrl-D ctrl-F ctrl-Y
up arrow keypad 8 ctrl-E ctrl-P
down arrow keypad 2 ctrl-X ctrl-N
On IBM-PC with compiled-in mouse the motions of the mouse move the
cursor.
DUPLICATE KEYS.
On an IBM-PC the arrow keys on the application pad duplicate the 101
keyboard arrow keys. On the MAC, use the keys on the application pad
and also any keys marked with arrows.
VERTICAL MOVES.
Vertical moves are done by cursor moves, page moves or the RETURN
key.
WordStar Emacs WordPerfect Duplicates
Page ahead ctrl-C ctrl-V PgDn R6:KP+:PageDn
Page back ctrl-R ESC v PgUp R3:KP-:PageUp
Return return return return none
Line ahead ctrl-Z ctrl-Z ctrl-Z none
Line back ctrl-W none ctrl-W none
Up ctrl-E ctrl-P UpArrow UpArrow
Down ctrl-X ctrl-N DnArrow DnArrow
The differences between the various ways of moving one line ahead or
back are subtle: in one case the cursor remains with the current line
and in the other the cursor moves. Page moves are by full screen with
no line of context. The cursor remains in the same screen location.
The commands of line ahead and back are used to change context
because they always cause lines to move on and off screen.
MOVE MANY PAGES.
To place the cursor ahead or back several pages:
Press the ENTER key.
Enter the number of pages NNN
Press the "Page ahead" or "Page back" key. See below for common key
assignments.
The action taken is to jump ahead or back NNN pages and refresh the
screen.
WordStar Emacs WordPerfect Duplicates
Page Back ctrl-R ESC V PgUp KeyPad-:R3
Page Ahead ctrl-C ctrl-V PgDn KeyPad+:R6:KeyPad,
MOVE MANY LINES.
To place the cursor ahead or back several lines:
Press the ENTER key.
Enter the number of lines NNN
Press the "Line ahead" or "Line back" key. See below for usual key
assignments.
WordStar Emacs WordPerfect Duplicates
Line Back ctrl-W ctrl-W ctrl-W none
Line Ahead ctrl-Z ctrl-Z ctrl-Z none
HORIZONTAL EDGE MOVES.
The cursor is placed at the start of the line or its very end, which
may imply a screen refresh, in case horizontal scrolling is needed to
display the targeted text. Usual key assignments:
WordStar Emacs WordPerfect Duplicates
Left edge ctrl-Q,ctrl-S ctrl-A Home+Left Home
Right edge ctrl-Q,ctrl-D ctrl-E End End
For horizontal edge moves the row remains the same and the column is
changed.
VERTICAL EDGE MOVES.
A vertical edge move places the cursor at the top or bottom screen
edge. No text scrolling will occur.
WordStar Emacs WordPerfect Duplicates
Top edge ctrl-Q,ctrl-E ESC , Home Up KeyPad5
Bottom edge ctrl-Q,ctrl-X ESC . Home Down
The precise result is to set column 1 for top and bottom moves.
END AND TOP OF FILE.
A move to top of file places the cursor on character 1 of the file. A
move to bottom of file places the cursor on the next character to be
entered at end of file. The refresh is therefore to the end of the
last line.
WordStar Emacs WordPerfect Duplicates
Top of file ctrl-Q,ctrl-R ESC < Home Home Up ENTER PgUp
End of file ctrl-Q,ctrl-C ESC > Home Home Down ENTER PgDn
GOTO A LINE NUMBER.
To goto a particular line number:
Press the MENU key and move to "EDIT". Choose "Goto line #" and
press RETURN.
Enter the digits for the line number.
Press RETURN.
SET BOOKMARK.
To set the current line and column: Ctrl-K,0
This is borrowed from Microsoft EDIT and Wordstar.
It's an experiment, to see if it is valuable.
GOTO BOOKMARK.
To goto the last marked line and column: Ctrl-Q,0
This is borrowed from Microsoft EDIT and Wordstar.
It's an experiment, to see if it is valuable.
CENTER TEXT IN MARGINS.
To center text on a line between the set margins choose "center Text"
on the "EDIT" menu. The left margin will always be 0. The right
margin is set by "Tab and margin" on the "VALUES" menu, default 72.
PARAGRAPH REFORM.
The principle use for this feature is to strip out unwanted blanks
and justify-left to a given right margin, default 72. The normal key
for reforms is ctrl--B for WordStar and WordPerfect keys, ESC-Q for
Emacs keys (Alt-Q on unix keyboards).
Reform can be executed from "Justify line" on the "EDIT" menu. It is
not especially convenient to do so. The reform key is a basic key.
Without the reform key, PI is fatally damaged.
SET REFORM MARGIN.
To set the right margin to 64:
Choose "Tab and margin" on the "VALUES" menu. Press RETURN to skip
the TAB set. Enter the number 64 at the margin prompt. Press
RETURN. If PERIOD is entered instead of 64, then the margin is set
at the cursor position.
REFORM SCOPE AND CONTEXT.
With auto indent ON, the reform scope for one reform key is one line
if the line is too long for the right margin, and two lines
otherwise. The reform context is from the cursor position forward.
With auto indent OFF, the reform scope is one line and the context is
again from the cursor position forward.
REFORM RULES.
Paragraphs are signaled by blank lines or leading white space. If
the cursor is at the front of the line, then all leading white space
is replaced by the number of spaces in a tab (which could be 0). All
other white space is truncated to one character per occurrence,
except at the end of a sentence, where one or two spaces are obeyed
and three or more are shrunk to two spaces.
Processing begins at the cursor, or the margin, so prior characters
are copied intact. Characters beyond the cursor and in particular the
set margin will be subject to reform.
One normal use for the reform key is to reform a hanging indent in
documentation. This requires auto indent, word wrap, insert mode and
hanging indent all ON. It will take a little practice to get it
right. Experiment!
HANGING INDENT.
When hanging indent is ON, blank fill occurs at the beginning of a
line to match the previous line. It is turned on and off by a toggle,
usually bound to ctrl-OU (auto-indent is bound to ctrl-OI, physically
next to it). Find it on the menu "Values" under "Hanging indent".
When this toggle is ON, paste from the mouse is problematic. It is
suggested to turn it off except when being used. It can be setup for
its default in PI.SET using the line
hang.indent.toggle=0; Toggle hanging indent mode (1=on,0=off)
hang.indent.toggle=1; Toggle hanging indent mode (1=on,0=off)
SPLIT LINE.
To split a line:
Position the cursor at the place to be split.
Select "Split line" on the "EDIT" menu. The cursor remains at its
original position. This is different than the action of RETURN in
insert mode because of the locked cursor position.
In the normal implementations of PI the LINEFEED key ctrl-J is
mapped to a more useful split line: ctrl-J splits the line and
moves the cursor to the next line.
JOIN LINES.
To join two lines:
Place the cursor at the start of the second line.
Insure that INSERT MODE is on.
Press DELETE to join the lines.
Lines may also be joined by deleting the word at end of line.
However, this method removes a portion of the line. Presently, lines
cannot be joined by pressing a delete key at end of line.
AUTO LINE SPLITTING.
Lines too long for the maximum line length are split on load and
separated by ctrl-B (`B' in inverse video at the start of the line).
To rejoin the lines, remove the ctrl-B at the front of the line. The
value for the maximum line length `line.max.chars' is set in the
resource file ~/.pirc or setup file PI.SET. Edit the file to increase
or decrease the maximum.
INSERT LINE.
To insert a line select "Insert line" from the "EDIT" menu.
WordStar Emacs WordPerfect Duplicates
ctrl-N ctrl-A,RETURN Home,Left,RETURN KP1:F3:L3:R13
The line is opened at the current position, which forces the old
current line down one. The cursor position remains unchanged,
pointing to the same location on the new blank line. When inserting a
line the cursor position along the line is irrelevant.
DELETE LINE.
To delete a line choose "Delete line" on the "EDIT" menu. The delete
line key is unique to WordStar and its clones. The duplicates are
implemented in Emacs and WordPerfect modes to make the operation a
single key.
WordStar Emacs WordPerfect
ctrl-Y ctrl-A,ctrl-K,ctrl-K Home,Left,ctrl-K,ctrl-K
Duplicates
KP3:F4:L4:R15
The position of the cursor along the line is irrelevant for the
delete line operation. After deletion, the line below becomes the
current line and the cursor position is unchanged.
ERASE LINE.
To erase to the end of the line, press the key below. To erase the
entire line, from column 1 to the end, press ENTER and then the key
below:
WordStar Emacs WordPerfect Duplicates
ctrl-Q,ctrl-T ctrl-K ctrl-K None
ctrl-Q,ctrl-Y none none None
On the "EDIT" menu the item is "Kill to end". The Wordstar
differences: ctrl-Q,ctrl-Y deletes to end of line but cannot join
lines. The other sequence acts like Emacs and Wordperfect.
DELETE MANY LINES NO SAVE.
To delete many lines select "Erase n lines" on the "EDIT" menu. A
prompt appears for the number of lines to delete from the cursor
position forward. The deleted lines are lost forever - very
dangerous! Very useful!
COPY LINE.
To copy the current line or a block of lines choose "Copy line" on
the "EDIT" menu. The menu system can be used to append the second and
further lines of a group or you can use the key shown on the status
line.
If multiple COPY LINE commands are given, then they start a new group
and append that group until another key is pressed. The first key
other than copy line ends the group. The menu key does not count as a
key for these purposes.
The DELETE LINE, KILL LINE and KILL WORD commands are used to form
groups also, in combination, but they cannot be mixed with COPY LINE,
since COPY LINE ends their group, and conversely.
The reason for the strange rule about mixing copy and delete is to
insure that the PASTE LINE operation will always paste a saved group
of consecutive lines.
The last ten previous groups are retained in an array. Also the last
group killed or copied is retained (until retired), making 11 groups
in memory at one time.
The last saved group can be pasted into the text by "Paste line" on
the "EDIT" menu. Other retired groups (10 max) can be pasted by
"Recover lines" on the EDIT menu. See PASTE LINE below for details
about how this works.
PASTE LINE.
To paste a line or block of lines at the cursor position, choose
"Paste line" from the "EDIT" menu. The paste applies only to the last
group saved. See COPY LINE above for more information on how the
lines are originally saved. See RECOVER LINES below for groups of
lines saved previously (not in the current group).
The reaction of the PASTE LINE key for a single line depends upon the
cursor position. If the cursor is at the front of the line, then a
new line is opened at the current cursor position and the text is
copied into the new blank line. The exception to this rule is when
the cursor is at the front of an empty line --- see below.
If the cursor is at the end of the line and only one line is in the
kill group, then PASTE LINE appends the current line (or a BELL if no
room to copy) but the cursor does not move. In particular, no extra
lines are opened.
If the cursor is mid line and only one line is in the kill group,
then PASTE LINE divides the line and appends the line from the group.
The cursor does not move, but the divided portion of the line appears
on a newly created line below the current line.
If the cursor position is beyond the end of line, then blanks are
added to fill to the current position and the copy proceeds as above
for end of line. No extra lines are opened to paste the first line of
the group. In particular, if the cursor is at the front of an empty
line, then the first group line is appended: no extra lines are
opened.
If the kill group has more than one line, then the first line gets
treated as above but remaining lines get copied into new lines below
the current line.
RECOVER SAVED LINES.
To recover one or more of the last 10 groups saved, choose "Recover
lines" from the "EDIT" menu.
The most recent saved group makes group 11. It is not in the list of
10 groups discussed here. For more information about the structure of
the 10 saved groups see MEMORY PURGE below.
The idea came from EMACS which allows previous kills to be recovered
(using bizarre rules). The PI implementation dumps the 10 arrays to
the screen one at a time from most recently used group to the oldest
group. Each dump is in inverse video. To keep or skip each one
respond to the status line prompt. The groups are unchanged by this
operation so that it can be repeated. However, future deletes WILL
change the array, so there is a transient nature to the saved groups:
they age and disappear automatically.
MEMORY USE OF SAVED STRINGS.
The array of saved groups contains 10 elements and the current group
recovered from the PASTE LINE key makes one more group. These groups
consume conventional memory. Under unix there is no lack of
conventional memory so the remarks below apply primarily to the PC
version of PI compiled in the medium memory model with large
pointers.
The catch is that files compete for the string space, so there has to
be space reserved in advance that files cannot use. The basic idea is
to reserve about 6 file buffers worth of space for strings. In even a
minimal installation that is about 24k of memory.
On a PC there is about 24k available total for the 11 groups,
although more is available if not used by files. This includes the
array size (500 lines normal) settable in PI.SET by variable
`killed.line.max'. An array size can be set so large that it consumes
excessive memory.
An array size of 100 and reserved space of just 24k can potentially
result in array allocations of 2200 bytes plus the line text involved
as the aged groups move down the array. About 300-400 full lines can
be saved before running out of memory whereas the setting of 100
lines might imply that 1100 lines can be saved.
Aging of groups moves a new first group and retires the last group
(10 groups total). All other groups are moved up one in the list. A
new group appears when a key change signals it or when the same key
is used repeatedly and the kill array becomes completely populated to
the array maximum size. An attempt to save a group of 200 lines will
result in two groups of 100 but no warning messages (the group size
of 100 is set in PI.SET).
Under normal use of the kill feature memory limits are never reached.
However, large kills of many lines, repeatedly, can cause the editor
to exhaust its 24k memory reserve. When this happens, all arrays are
dumped to the NotePad and memory gets recovered so the editor can
continue. A warning is sent to the status line.
MEMORY PURGE OF SAVED STRINGS.
The memory release of saved strings and their corresponding arrays
can be executed, without the NotePad dump, by pressing the key on
menu "EDIT" referenced as "Memory purge". See above for the exact
meaning of the memory release. Please note that this release is
permanent: it cannot be undone and all saved text is lost.
The NotePad dump can be simulated by "Paste lines" to dump the 11th
array into the NotePad followed by "Recover Lines". Both appear on
the "EDIT" menu. This manual dump must be executed while editing the
notepad to create the simulation. If done in another buffer, then it
adulterates the current text. Other than the location of the dumped
text, the result is the same.
ERASE CURSOR LINE.
To erase the line on which the cursor is placed, from front of line
to the end of the line, press ENTER followed by the key for "Kill to
end" on the "EDIT" menu.
This function is identical to "Cursor home" plus "Kill to end".
Consequently, the cursor is placed at the front of the line by this
function.
TRANSPOSE LINES.
To switch the current line with the previous line choose "Transpose
lines" on the "Keymap editor" in the "KEYS" menu. The key assignment
varies among implementations:
WordStar Emacs WordPerfect Duplicates
ALT-L ESC t ALT-L none
TRANSPOSE CHARACTERS.
To transpose the previous two characters before the cursor position
choose "Transpose characters" on the "Keymap editor" in the "KEYS"
menu. The key assignments:
WordStar Emacs WordPerfect Duplicates
ALT-T ctrl-T ALT-T ctrl-O,t
If there is only one character before the cursor, then nothing
happens. The transposition applies only to the current line, that is,
this operation does not affect the previous line.
DELETE CHARACTER RIGHT.
To delete the character right of the cursor press the following key:
WordStar Emacs WordPerfect Duplicates
ctrl-G ctrl-D Del Del:R9:KP9
QUOTE NEXT CHARACTER.
To enter a control code into the text choose "Quote next" on the
"Keymap editor" in the "KEYS" menu. The key assignments:
WordStar Emacs WordPerfect Duplicates
ctrl-P ctrl-Q ctrl-V none
ENTER EXTENDED CHARACTER.
Related to character quoting is the function which adds 128 to the
previous character, bound to ctrl-OE. See the keymap editor and
search for line
1050 Add 128 to previous character [EXTENDEDCHAR]
An ASCII code in the range 128 to 255 represents a character in
iso-8859 codes for common language extensions. Addin 128 is an
alternative and faster method for entering extended characters.
The entry of extended characters on an IBM keyboard is made from the
application pad using the decimal Ascii code. Here, the ALT key is
held down while a number is typed on the application pad. For
example, 225 results in greek beta. This convention makes the
extended character entry less likely to occur by accident.
See also the FOREIGN CHARACTER CYCLE TABLE for entry of foreign
characters by the cycling method.
REVEAL FUNCTION KEY CODES.
The quote key is used commonly in the inspection of function keys. On
most terminals you can press the quote key and then a function key to
reveal the exact sequence emitted by the function key. Naturally the
codes get inserted into the text, so it is useful to do this in the
notepad or a scratch buffer.
Example. Inject codes for F10 into the text.
Press ctrl-V for Emacs or Wordperfect mode, ctrl-P for Wordstar
mode. Press F10. The codes will appear at the cursor position. On
an IBM-PC you should see `C' with cedilla plus `D'. This stands for
ASCII codes 128 and 68 (decimal). The PI editor does not use code 0
for strings so all code 0 keys get mapped to 128.
SEARCH TOKEN FOR BEGIN/END LINE.
The character used in a search string to indicate the beginning or
end of a line has to be unusual so that it does not conflict with
ordinary text. This value is normally set to -128 in the PI.SET or
".pirc" source file using the resource line
search.token.lf=-128; Token in search string used for begin or end line
The value -128 is the sign extension to integer data type from the
character value '\200' (128 decimal). This is the editor's internal
idea of the NULL character which is entered by Ctrl-Shift-@.
Under unix, pressing the key Ctrl-Shift-@ produces the null
character, which the editor translates into 0+128 or '\200'. On an
IBM-PC, the sequence Ctrl-Shift-@ is not the null character, so we
define a key sequence to make it so, in agreement with unix usage.
This key sequence is compiled into the editor defaults, so you don't
need to set the key.
In addition, the control Ctrl-O,z is used as a second sequence to
insert this unusual character, in case Ctrl-Shift-@ does not work,
e.g., using Kermit remotely.
The action taken for this search character was described in the
section on searching. To reiterate, if the token is first in the
search string, then the search must match the beginning of the line.
If the token appears at the end of the line, then the search must
match the end of the line. For example, two successive tokens match a
line with empty contents, i.e., a blank line.
The bad thing is that you cannot search for this special character at
all, unless it happens to be in the middle of a search string. For
example, search string "XX " will search for zero token X followed
by a space at the beginning of a line. If zero token X is the only
character on the line, then search string "XXX" will find it.
EXAMPLE. Replace each adjacent pair of empty
lines by one empty line.
SOLUTION: Start a macro, searching for an empty line. The search
string is Ctrl-Shift-@ plus Ctrl-Shift-@. Search again for an
empty line (two searches total). Put the cursor on the previous line,
at the beginning. Search on this line only for the same search string
(Ctrl-O,F). Delete the line. End the macro.
Naturally, this macro won't be defined unless there **IS** a pair of
adjacent empty lines in the file. Assuming the macro was defined,
successfully, then press F7 or L7 enough times to search and replace
the whole file.
What about the **BEEP** on each failure?
The fix: save the current macro under key Alt-1 (for example). Make
the current macro give an argument of -1 and then invoke Alt-1. This
macro is silent. The macro key F7/L7 is normally a repeat key, so you
can hold down on it to accomplish the replacements.
UNIX FOREIGN CHARACTER SETS AND FONTS.
Since X displays Xterm windows with a default character set of 128
characters, the so-called fixed fonts, required foreign fonts are not
readily available for novices. Some unix setup is required to get the
foreign sets on screen. Most foreign sets can be displayed under X.
For Xterm or Rxvt, the command line syntax is
xterm -fn fontname &
to load the application with a different font "fontname". Therein is
the catch: you have to know the fontname. To find font names, use the
X applications "xlsfonts" and "xfontsel".
To some extent, changes can be automated by sending escape sequences
to Xterm, e.g.,
echo -e "\033]50;fixed\7"
echo -e "\033]50;vga\7"
will change to font "fixed" or "vga" respectively. A font change can
be executed from a macro using "Execute script" on the PI menu.
To make a macro to change to font "fixed", press these keys:
1. F8 (select "Recording" on the "Keys" menu)
2. ^O^Q (select "Execute script" on the "Tools" menu)
3. echo -e "\033]50;fixed\7"
4. RETURN
5. F7 (select "Replay keys" on the "Keys" menu)
The macro can be saved on the "Keys" menu, and finally added to the
"Tools" menu where it can be used. The key used to save it can be
deleted, because items on the "Tools" menu can be executed without a
key binding.
MS-DOS FOREIGN CHARACTER SETS AND FONTS.
If working under Windows 95/98/2000, then only the code page setup
applies. Hopefully, this is the default for most everyone, but other
information is recorded here to cover older machines with Windows 3.1
or earlier.
WINDOWS 3.1-2000.
Apply the ideas below to the batch file that replaces autoexec.bat in
the startup of a give DOS window. No config.sys are required. The
example is for code page 852, which corresponds to languages like
Slovak and Czech, using latin2 fonts. These commands do not affect
the keyboard in Windows; see Windows help for adding special
keyboards.
@echo off
mode con cp prepare=((852) c:\windows\command\ega.cpi)
mode con cp select=852
OLDER DOS SYSTEMS.
The font support situation with IBM-PC machines is completely
different since support for many foreign character sets has been
built into DOS 5.0. Assumed is a VGA or EGA display, extended
keyboard with F12 key and DOS 5.0 or later. It will work with the
Hercules or CGA video adaptors provided the language is supported by
the standard USA character set (in this case, no special setup is
required). Illustrated below is the method of setup for the Czech
character set. Similar remarks apply to the others supported by DOS
5.0. Choose **ONE** of the methods below. The first is the simplest.
DOS 5.0+ CODE PAGE METHOD.
In order to use this feature of DOS 5.0, the following lines are
required in CONFIG.SYS. The purpose here is to reserve space in main
computer memory for the Czech character set (see DOS 5.0 manual) and
also the USA character set. No character data gets loaded nor is
there a switch from the USA character set, until a mode command gets
issued at the DOS prompt --- see below.
country=042,,c:\dos\country.sys
device=c:\dos\display.sys con=(ega,852,1)
To load the Czech character set data into memory and switch from USA
set to Czech set, the following lines are required, typed at the DOS
prompt. See the DOS 5.0 manual for details about the mode command.
mode con codepage prepare=((852) c:\dos\ega.cpi)
mode con codepage select=852
The commands above are generally placed in a batch file in order to
automate the task. Names like czech.bat are common.
The DOS CODE PAGE method is far from ideal because it has a lot of
system overhead and it lacks portability across different versions of
DOS. Moreover, it is difficult to undo the effects.
GRIFFITH'S FONT EDITOR AND TSR.
An easy solution is to use the code page 852 fonts from "Font Editor
v3.0" by S Griffiths (1993). This shareware font editor is full-
featured and solves the problem of font creation and management
for most European languages. It is available at ftp://www.coast.net/.
His editor allows you to make a permanently installable TSR that
keeps the font in memory, or it can be a transient program loaded
with the editor itself. The best part of this is customization of the
font and the possibility to solve the same problem with other
languages.
The mechanics of loading different fonts is as follows. Make a batch
file that contains the commands need to load the font and then attach
the running of that file to a macro key. The "VGA Font" item on the
"QUIT" menu is such a link. The batch file contents that work with
Griffith's fonts:
Loadhigh c:\usr\CP852F16.COM
The COM file is made from the font editor by loading (F10) in a font
called CP852F16.FNT, then saving (F5) it as a COM file. Pretty easy?
Some laptops and portables have very complex problems related to
loading alternate character sets. Experiments are required to see if
it will work (at all). The main disadvantage of Griffith's TSR is
that there is no way to unload it from memory.
YOSSI GIL'S LOADFONT.
According to the doumentation, this program loads a user-defined font
to EGA/VGA. The version tested is 1.5, Jun 09 1993 Copyright (c)
1991-1993 by Yossi Gil, P.O.Box 3148, Jerusalem, ISRAEL, Email:
yogi@cs.technion.ac.il [available at ftp://www.coast.net/].
The operation with the font described above is
LOADFONT CP852F16.FNT
which stuffs the character set into the VGA adapter, while PI is
running, from a batch file like VGAFONT.BAT. The advantage of this
method is that the effect lasts only a short time and there is NO
SYSTEM OVERHEAD (no memory use).
The disadvantage is in forking tasks from PI, for example, a DVI
viewer will reset the text mode and therefore undo Yossi's font load
to the VGA adaptor. Of course, you can load it again, but that is one
more element of trouble.
FOREIGN CHARACTER CYCLE KEY.
This version of PI allows for extended character entry for foreign
character sets.
The basic key manipulation involves just one key on the keyboard
called the "Foreign cycle key". On an IBM-PC it is ctrl-\ or F12. See
the "Keymap editor" on the "KEYS" menu for the actual key assignment.
The idea for the use of the "Foreign cycle key" is to change the
character just left of the cursor by rules outlined below. In most
cases the possibilities for the change are among two or three
characters: a base character from the English set and one or two
foreign characters that look like it. For example, `?' and its upside
down Spanish version might occur as a pair and each press of the
cycle key produces the other member of the pair.
The basic ideas of operation for Czech characters are as follows:
Long vowels a, e, i, o, y (lower and upper case). Press F12 when
the cursor is just to the right of the vowel.
Long vowel u. Press F12 once or twice. The first press produces the
long u used at the front of a word, while the second press produces
the long u used inside a word.
Hooked vowel e. Press F12 twice. The first press produces long e,
the second hook e.
Hooked consonants c, d, n, r, s, t, z (upper and lower case). Press
F12 when the cursor is just to the right of the consonant.
Key F12 cycles among the choices. There is no danger in pressing
F12 too many times. No action occurs if F12 is pressed for a
non-Czech character.
OTHER FOREIGN CHARACTERS.
The macro keys can be used to insert new characters into the text
with a single key press. Function keys are best for this application.
A usual example: record a macro that inserts the character. Map it to
function key F11. To enter the special character press F11.
It is possible to directly enter extended characters 129-255 ASCII.
The procedure: hold down ALT and type the decimal ASCII code from the
application pad. When ALT is released the extended character will
appear on the screen at the cursor position. This procedure also
works for ASCII codes 0-127, which is important to know because of
the possibility of a typo.
FOREIGN CHARACTER CYCLE TABLE.
The Czech character set cycle table is below:
OLD NEW
------------------------------------------------
' ' 243 /* Hook on blank space */
'a' 160 /* long vowel, lower case */
'e' 130
'i' 161
'o' 162
'u' 163
'y' 236
'c' 159 /* hook consonant, lower case */
'd' 212
'n' 229
'r' 253
's' 231
't' 156
'z' 167
'A' 181 /* long vowel, upper case */
'E' 144
'I' 214
'O' 224
'U' 233
'Y' 237
'C' 172 /* hook consonant, upper case */
'D' 210
'N' 213
'R' 252
'S' 230
'T' 155
'Z' 166
163 133 /* long u to u-circle */
133 'u' /* u-circle to u */
130 216 /* long e to e-hook */
216 'e' /* e-hook to e */
144 183 /* long E to E-hook */
183 'E' /* E-hook to E */
The algorithm works as follows. The character X left of the current
cursor position is read. An attempt is made to match X against a
character in the "OLD" column. If it works, then X gets replaced by
the corresponding character in the "NEW" column. Otherwise, a second
attempt is made to match X from the "NEW" column. If successful, then
the corresponding character from the "OLD" column replaces X.
The basic idea works as long as the characters are based on accented
versions of some standard letter in the alphabet. It does not work on
Greek, Russian or Chinese because the alphabets are too far removed
from the Latin character set on the USA keyboard.
To load the foreign cycle table requires the same action as a keymap
load. In fact, the table can be kept in the same physical file
already used for private keymaps or macros, usually called PI.SET
(or ~/.pirc under unix).
A usual load for Czech keys would appear as below in the file PI.SET:
31000
foreign=
foreign=\325R\374S\346T\233Z\246\243\205\205u\202\330\330e\220\267\267E
foreign=\347t\234z\247A\265E\220I\326O\340U\351Y\355C\254D\322N
foreign=\40\363a\240e\202i\241o\242u\243y\354c\237d\324n\345r\375s
The internal loading occurs in the reverse order of the lines, but
left to right. Entries must be in pairs, as explained above. The
first line releases any memory already assigned to the foreign cycle
table. Each of the other lines appends the table (in reverse order of
lines). The maximum total length of the cycle table is 510 bytes.
This refers to the loaded size after decoding - the above table is 66
characters long in decoded form.
The number 31000 starts in column 1. It is used to alert the loading
program that the cycle table will be loaded next. It does not
correspond to a key assignment. Without the 31000, nothing happens,
which is by design.
The characters in the cycle table above are represented by octal
escape sequences. This is not required on an IBM-PC. Under unix it is
advisable because 8-bit characters are unreliable for display (font
support is possible in X11R5 and later).
CHARACTER TO LOWER CASE.
To change the character at the cursor to lower case use the key map
given by "Change character at cursor to lower" on the "Complete key
list" in the "KEYS" menu.
In Wordstar mode this is ctrl-O,l. It is not enabled in the other
modes. Used primarily in macros.
CHARACTER TO UPPER CASE.
To change the character at the cursor to upper case use the key map
given by "Change character at cursor to upper" on the "Complete key
list" in the "KEYS" menu.
In Wordstar mode this is ctrl-O,u. It is not enabled in the other
modes. Used primarily in macros.
NEW SEARCH.
To start a new search forward or reverse choose "New search" on the
"SEARCH" menu. A prompt appears for a new search string.
The search string can be replaced and edited on each invocation. It
responds to F5 or F6 as license to carry out the default search. To
recall and edit the default string press Up arrow on a blank status
line. Once text appears on the status line, the up arrow recalls the
50 past search strings in chronological order, cycling finally to the
default search string.
The other search commands simply seek out a match either forward or
reverse on the default search string. They are mapped to easy to
reach function keys like F5 and F6 (L5 and L6 on SUN keyboards) or
the PERIOD and ZERO application keys on a DEC or MAC keyboard.
The search matches are forced to the center line of the screen. It
seems to provide good context in the majority of cases. A search
failure rings the terminal bell and also stops any repeated operation
or macro.
Backward search performs as expected by any novice, seeking the next
match backwards, first on the current line, then on previous lines.
This search will not match the current position.
Searches can be made starting at the beginning of a line or matching
the end of a line, by including a special character in the search
string (called a token). The token is normally mapped to control -
shift-@, which is char 0, but the editor maps this again to ASCII
128. Nevertheless, we call this character token the ZERO token,
because it represents the null at the end of a line, which the editor
uses to replace the cr/lf combination at the end of lines. The ZERO
token is defined in the pi.set or .pirc source file on editor startup
as -128, because of sign extension of characters by most C compilers.
You can change the token character, but be careful of sign extension.
Searches for the beginning of line should have the ZERO TOKEN at the
front of the line. Matches for the end of the line should have the
ZERO TOKEN as the last character in the search string. A particular
case is an empty line, which is searched for by entering a search
string with two ZERO TOKENS.
Searches restrained to the current line will match forward from the
current cursor position, and backward from a position to the left of
the cursor position. With two exceptions: if the search string
contains one or two tokens for the end or beginning of line. In this
case, the logic is applied that an empty search string can still
match the end or beginning of the line. An interesting case is this
kind of search applied on an empty line with search string equal to
two ZERO tokens. Searching forward matches! Therefore, the search
succeeds, but does not move the cursor.
The line search is helpful in trying to delete successive blank
lines. A search forward is made for a blank line using two ZERO
tokens. Then press RETURN to go down one line and search that line
for the same string. It will fail if the line is not empty and
succeed otherwise. Therefore, if this logic is in a macro, then the
macro can proceed after the successful search to delete the extra
blank line!
The highlighting of search matches is done for all searches. On
certain X window displays this is annoying because of a non-blinking
cursor (may be cured by X some day).
SEARCH FORWARD.
To search forward for the default search string choose "Search
forward" on the "SEARCH" menu. This is usually mapped also to
function key F5 or L5 or PERIOD on the application pad.
The default search string is replaced, provided the search starts
with the ENTER key, a new string, and the string entry terminates
with Ctrl-O,f or its equivalent (F5, L5, PERIOD).
Pressing Ctrl-O,f (or F5, L5, PERIOD) directly after the ENTER key
will produce a copy of the last search string. Use UPARROW to cycle
through the last 50 search strings. End with Ctrl-O,f (or F5, L5,
PERIOD) to begin the search.
SEARCH BACKWARD.
To search backward for the default search string choose "Search
backward" on the "SEARCH" menu. This is usually mapped also to
function key F6 or L6 or ZERO on the application pad.
The default search string is replaced, provided the search starts
with the ENTER key, a new string, and the string entry terminates
with Ctrl-O,b or its equivalent (F6, L6, ZERO).
Pressing Ctrl-O,b (or F6, L6, ZERO) directly after the ENTER key will
produce a copy of the last search string. Use UPARROW to cycle
through the last 50 search strings. End with Ctrl-O,b (or F6, L6,
ZERO) to begin the search.
SEARCH LINE ONLY FORWARD.
To search the current line only forward for the default search string
choose "..within line" on the "SEARCH" menu. This is usually mapped
to key Ctrl-O,F. This function has a definite use in macros, to test
the existence of a string on the line. The search fails if the string
is not matched.
Unlike the F5 search, the search begins at the current cursor
position, rather than one character to the right. In particular, a
search for Ctrl-Shift-@ plus Ctrl-Shift-@ will succeed on a
completely empty line, provided the cursor is at the start of the
line.
The default search string is replaced, provided the search starts
with the ENTER key, a new string, and the string entry terminates
with Ctrl-O,F or its equivalent.
SEARCH LINE ONLY BACKWARD.
To search the current line only backward for the default search
string choose "..within line" on the "SEARCH" menu. This is usually
mapped to key Ctrl-O,B. The search begins one character to the left
of the current cursor position.
The default search string is replaced, provided the search starts
with the ENTER key, a new string, and the string entry terminates
with Ctrl-O,B or its equivalent.
QUERY REPLACE.
To search for a string and replace it, do these steps:
Press the MENU key and move to "SEARCH". Choose "Query/replace" and
press RETURN.
The string last searched will appear. Once text appears on the status
line, the up arrow recalls the 50 past search strings in
chronological order, cycling finally to the default search string.
Make changes and press RETURN. If the search fails, then so does
Query/Replace.
REPLACE: Y=Yes, A=All, Q=Quit, P=Prev, N=Next [N]: will appear on
the status line. The string match appears in inverse video. Press
one of the letters YAQPN or RETURN to take appropriate action.
The string replacement last used will appear the first time you
try to make a replacement of text. Make changes and press RETURN.
This string is used until you QUIT or a search fails. A blank
string is acceptable.
Listen for the bell as you proceed - it signals the end of the
Query/Replace (typing Q is a silent exit).
TOGGLE FOLD CASE FOR SEARCHING.
The switch is "Fold case on/off" on the "SEARCH" menu. For case fold,
the search string is mapped to upper case, and the target strings are
mapped to upper on compare. You can detect case fold by the uppercase
search string, displayed on the status line or by applying the toggle
twice.
SET REPEAT COUNT.
To set the repeat count for the next key choose "Set repeat count" on
the "Keymap editor" in the "KEYS" menu. The key map is usually
ctrl-Q,ctrl-Q (Wordstar) or ctrl-U (Emacs).
Repeat counts can be given to a saved macro. These will always run
verbose. The default macro is the only one that can run silent, but
it can call the saved macros, causing them to run silent also. The
default macro can also run off a repeat count, but this is again
verbose, never silent.
Silent running of the system macro begins by ENTER and then a
negative count, followed by the key for the default macro (F7 or L7
is a normal function key).
Repeat counts can be given to a number of other keys. Basically, it
must make sense. Examples: cursor keys, page and line moves, insert
and delete line, return key, tab key, delete word, word moves.
MEMORIZE STEPS.
To memorize a sequence of key strokes:
Press the MENU key and move to "Keys". Choose "Memorize keys" and
press RETURN. The status line should display the key to press
which ends the memorization process.
Key in the steps as usual. These steps may contain macro execution
keys (exceptions below).
Press the key displayed on the status line advertised to end
memorization.
A tactical error is to go back to the "Keys" menu and choose
"Memorize keys" again, which discards all steps to that point and
starts memorizing again! However, it is correct to choose "Replay
keys" to end the macro definition.
REUSE. The macro buffer gets erased each time a new recording is
started. To save the current macro text, press the MENU key, move to
"Keys". Choose "Save current macro" and press return. A prompt
appears for a key sequence on which to save the macro. See the text
below about saving macros.
EXECUTE MEMORIZED STEPS ONCE.
To execute memorized key strokes just once, press the key for "Replay
keys" on the "Keys" menu. This is always verbose.
STOP MEMORIZE.
The same key as used above stops the memorization of macro steps.
EXECUTE MEMORIZED STEPS MANY TIMES.
To execute memorized key strokes N times and view the progress
(verbose mode):
Press the MENU key and move to "Keys". Choose "Repeat replay #"
and press RETURN.
Type the digits of the number N. Press RETURN.
To abort, press any key (right arrow is a good choice). To stop
type--ahead macros, press the abort key, usually ctrl-U or ctrl-C or
ctrl-G.
SILENT EXECUTE MEMORIZED STEPS MANY TIMES.
To execute memorized key strokes N times, silent running:
Press the MENU key and move to "Keys". Choose "Repeat replay #" and
press RETURN.
Enter a minus sign `-' and the digits of the number N. Important:
the minus sign signals silent running!
Press RETURN.
To abort during the run, press RETURN.
To stop type--ahead macros, press the abort key (ctrl-U or ctrl-C
or ctrl-G depending on the setup file PI.SET or ~/.pirc). To be
absolutely correct, most any key will stop the macro.
SAVE CURRENT MACRO.
To save the current default macro choose "Save current macro" on the
"Keys" menu. A prompt appears for the key sequence to be assigned to
this macro. If successful, then the current macro and the newly saved
one are identical.
A new macro can be saved again with the same key used previously.
There is no complaint about re-using a previously assigned macro key.
Naturally, the contents of the previously assigned macro are lost,
but they are saved in PI.SET (or .pirc) as a comment.
The macros get saved in an array of default size 256, this size being
set up in PI.SET. A saved macro only uses the actual number of bytes
in its description, usually a lot less than 256 bytes. The array used
to save macros uses conventional memory so it should not be
artificially large. About 25 is a good number. See PI.SET.
These macros can be nested to 10 deep: macro 1 can call macro 3 and
it can call macro 7, etc. Deep recursion is detected. A key hit
during a macro aborts it.
RUN NON-DEFAULT MACRO.
To run a macro that has been saved you don't need to remember the
key to press which invokes the macro. Press the MENU key and move to
"Keys". Choose "Macro editor" and press RETURN. The editor will load
a buffer with the current state of the macro keys. The macro can be
run by pressing PERIOD.
ABORTS DURING RECORDING.
If you are recording and press the key for "Replay keys", then
macro recording will cease and the macro is defined. To make the
macro inactive, press "Record" and then "Replay" keys; see below.
EMPTY MACRO.
If a macro buffer contains no characters, then no action will
result from pressing the "Replay" key.
DYNAMIC RE-DEFINITION OF MACROS.
Any macro key can be re-defined at any time. This can be a
pleasant feature or an unexpected disaster. Fortunately, macro
text is documented in PI.SET. If there is a problem, then look
there for a way to recover the macro text.
RECURSION IN MACROS.
More than 10 levels of recursion will cause the recording to
abort. Macro 1 can call macro 2, and it can call macro 3, etc, up
to 10 deep. The common error is a cycle: 1 calls 2 and 2 calls 1.
Cycles occur by dynamic re-definition which in practise is
difficult to achieve but nonetheless possible.
DEFINE KEY AND DEFINE KEY DUPLICATE.
Keys are defined by a keymap source file upon load of PI, or by
adding definitions during editing. This section describes the
interactive definition of new keys and key duplicates.
To define a new key or a duplicate key in PI, press the MENU key and
move to "KEYS". Choose "Keymap editor" and press RETURN. Move to an
entry and press + to add a key or - to delete a key.
WRITE FILE PI-MACRO.KEY
To create the macro dump file "pi-macro.key" choose "Write
pi-macro.key" on the "Other" menu.
This function creates a disk file "pi-macro.key" in the current
directory with the macro keys listed in loadable format, with
descriptions. It is used to move just the macro keys into a new
directory.
Also written in the file is string "LeadinSTR" which documents all
lead-in characters used in the current keymap. These characters are
obtained by copying the first character from each nonzero keymap
string. See LeadinSTR in file "pi-macro.key". A leadin character
causes the key routine in PI to abort passing the key as an insert.
Instead, PI decodes the character as the first character of a keymap
string. There can be a delay until enough characters are keyed in to
identify a valid keymap string or to abort the decoding.
The file PI-MACRO.KEY is loaded automatically from the directory in
which PI is started. The load takes place after the system loading
of key definitions and macros from PI.SET. The PIEINIT environment
variable and the command line switches for loading keys can be used
to automate the loading of unusual macro and key definitions.
WRITE FILE PI-DUMP.KEY
To save the keyboard mapping in a file, press the MENU key and move
to "Other". Choose "Write pi-dump.key" and press RETURN. The file
pi-dump.key will be saved. Load it into an edit buffer for
inspection. This file can be used to load your own private keys.
This function creates a disk file "pi-dump.key" in the current
directory with all keys including macro keys in loadable format, with
descriptions. It uses PI.DAT for the descriptions and it will not be
created unless that file is present. If the function fails to produce
a file, then you can expect that PI.DAT is not in the same directory
as PI.EXE. Under unix PI.DAT is called keymap.dat. The same location
rules apply.
KEY MAP FILE FORMAT.
The format is explained in each copy of "PI-DUMP.KEY" produced by
"Write pi-dump.key" on the "Other" menu. If you are interested in
customization, then print "PI-DUMP.KEY" for reference.
INSTALL KEY MAP FILE.
To install a properly made key map file choose "Read a keymap file"
on the "Other" menu.
This function uses conventional memory. It is best to load it at
startup via PI.SET, which is automatic (PI.SET is not loaded if
unavailable). The same advice applies under unix to the file ~/.pirc
or ./.pirc.
Previous strings used in the keymap are not freed, because they are a
mixture of static data in PI.EXE and possibly memory assigned by SBRK
or MALLOC memory managers. It is impossible to free static data,
hence the decision to not free anything at all.
The effect of the load is immediate. Sorting the table occurs
dynamically and automatically. Study PI.DAT and PI-DUMP.KEY carefully
before doing any hand editing --- it is best to create source by
using the Keymap editor until the combinations are obtained. In
unusual cases, this is impossible, and you will have to resort to
editing the key file by hand.
SET EMACS KEYS.
To set Emacs keys on a unix system choose "Set Emacs keys" on the
"Other" menu. The old key install is lost but any macro keys defined
manually or otherwise will still exist. The macro keys can be
redefined in the "macro editor" on the "keys" menu.
The key load is taken from "$PIE/emacs.keys" using the terminal type
determined by the TERM variable and TERMCAP information. If
select.emulation=1; appears in ~/.pirc, then no extra keys will be
loaded.
SET WORDSTAR KEYS.
To set Wordstar keys on a unix system choose "Set Wordstar keys" on
the "Other" menu. The old key install is lost but any macro
keys defined manually or otherwise will still exist.
The key load is similar to the emacs load discussed above, except
directory "$PIE/wdstar.keys" is used.
SET WORDPERFECT KEYS.
To set Wordperfect keys on a unix system choose "Set Wordperfect
keys" on the "Other" menu. The old key install is lost but any
macro keys defined manually or otherwise will stil exist.
The key load is similar to the emacs load discussed above, except
directory "$PIE/wdperf.keys" is used.
WORD AHEAD.
To move the cursor one word ahead choose "Next word" on the "WORD"
menu. The cursor moves to the first punctuation after the current
word. Try it a few times to see how it handles end of line.
The movement of the cursor parallels what is expected in emacs. It
does NOT replicate the cursor movement in Wordstar or Wordperfect.
WORD BACK.
To move the cursor one word back choose "Previous word" from the
"WORD" menu. The cursor moves to the beginning of the previous word.
The beginning of a line causes special processing. Try it to see how
it works.
The movement of the cursor parallels what is expected in emacs. It
does NOT replicate the cursor movement in Emacs, Wordstar or
Wordperfect.
ERASE WORD AT CURSOR.
To erase or kill the word in front of the cursor choose "Delete word"
on the "WORD" menu.
The action parallels the Emacs delete word key: each key erases
initial white space and punctuation after the cursor, then up to the
end of the word.
If at end of line, then the key removes the line separator. The word
on the next line is not killed because the line is joined to the
current line.
PASTE LINE brings back the group as one unit. The group is formed
from multiple mixed delete word, delete line and kill line commands.
CAPITALIZE WORD.
To capitalize a word choose "Capitalize word" on the "WORD" menu.
The capitalize function will cap the character at the cursor and
change to lower case the letters after the cursor. It breaks on the
first non-alphanumeric character.
Basically, the cursor ends up where WORD AHEAD would place the cursor.
Starting on non-alpha causes a skip to the first alpha character. But
it won't back up if you start on an alpha character.
LOWER CASE WORD.
To change a word to lower case choose "Lowercase word" on the "WORD"
menu. It works like CAPITALIZE WORD except it lowercases the first
letter.
UPPER CASE WORD.
To change a word to upper case choose "Uppercase word" on the "WORD"
menu. It works like CAPITALIZE WORD except it uppercases the following
letters.
FILL PHRASE BUFFER WITH TEXT.
To copy current characters to the phrase buffer:
Position the cursor.
Press the key for "Fill phrase string" on the "WORD" menu.
Press the right arrow key or backspace key or END key to copy
characters and then RETURN when finished. The characters are placed
in the phrase buffer, which is over--written on each use.
Uses of this feature include the transport of graphics characters
and efficient deletion or insertion of words and phrases from the
text. See below for methods.
This feature exists as a substitute for mouse cut and paste when
editing remotely or in non-mouse environments. It is also efficient
for use in macros, to do operations that are suggested by mouse
operations.
PASTE PHRASE.
To paste the phrase buffer at the current cursor position choose
"Paste phrase string" on the "WORD" menu.
Whatever was in the phrase buffer will be copied to the screen as
though typed. Undo the effect with "Kill phrase match" on the "WORD"
menu. The cursor must be on the first character of the proposed
match.
Special effects: If INSERT is on, then the characters are inserted,
otherwise over-write occurs.
KILL WORD OR PHRASE MATCH.
To delete the word or phrase matching the phrase buffer at the cursor
position:
The cursor position is important. Action is taken only in case the
phrase buffer matches the characters to the right of the current
cursor position!
Choose "Kill phrase match" on the "WORD" menu. The matching
characters are removed. To undo the effect, insure INSERT is on and
choose "Inject word/phrase" on the "WORD" menu.
optbuf [OPTMATH]>
IntMath ON PHRASE STRING
Calls function convert2int() to treat the current text in the phrase
buffer as an arithmetic problem. This function interprets the text as
an arithmetic problem involving **INTEGER** addition, subtraction,
multiplication and division. The conversion stops at the first
character that makes no sense. The integer computed by this operation
is converted to text and replaces the contents of the phrase buffer.
LIMITATIONS. Presently, the function cannot handle parentheses, due to
the basic nature of convert2int(). It can't handle floating point
decimal numbers either. This function is as endowed as a simple
4-function calculator, using only integer arithmetic.
CHAINING. Operation chains can work, for example, 2*6/2/2 converts to
3. Check this out by pressing Ctrl-OC, enter 2*6/2/2, then press
Ctrl-O,i to convert and view.
JUNK CHARACTERS. The problem text ((2*6)/2)/2 converts to 0, because
parentheses are not understood. However, this can be an advantage,
because "2*3{" converts to 6, the curly brace being a junk character.
In use, text like "2 +16{Extra Junk" converts like "2 +16".
USAGE. The principal service intended was to produce item numbering or
to add columns of integers. Always, this is done by a keyboard macro.
The basic idea is to load the phrase string with the text of an
arithmetic problem. Then apply this function to do the problem, with
the answer replacing the problem text in the phrase string.
FloatMath ON PHRASE STRING
Calls function convert2double() to treat the current text in the
phrase string as an arithmetic problem. This function interprets the
text as an arithmetic problem involving **FLOAT** addition,
subtraction, multiplication and division. The conversion stops at the
first character that makes no sense. The double computed by this
operation is converted to text and replaces the contents of the phrase
string.
LIMITATIONS. Presently, the function cannot handle parentheses, due to
the basic nature of convert2double(). This function is a simple
4-function calculator and no more.
CHAINING AND JUNK CHARACTERS. The operation is the same as the integer
version of this function.
USAGE. The principal service intended was to produce formatted numeric
output, especially for adding columns of financial or scientific data.
The strength of this simplistic package is the formatted output, which
uses sprintf() from C language. It has the advantage of working on
text strings containing garbage characters.
SET FORMAT STRING FOR FLOAT CONVERSION.
To invoke this function apply "Set math format" on the "WORD" menu.
You are expected to enter a string of characters that describes the
math output format.
The second prompt asks for DOUBLE (0) or INTEGER (1) data to be
applied to the format string. For example, if the format string
contains "%d" or "%c", then the expected data type is INTEGER.
The function accepts a new string for "sprintf", the C function used
to do the output conversion. The normal one is "%.08g". To replace it,
enter just the string itself, without double quotes, but with all
printf rules applied. Some useful formats:
1. "%.g" Prints numbers without decimal points, dropping
decimal digits.
2. "ans=%f" Prints "ans=" and then the answer in decimal
format.
3. "%-12.4f" Left justify the number in a field of width 12
with 4 decimal digits.
4. "%-012.4f" Left justify the number in a field of width 12
with 4 decimal digits, zero-filled.
5. "%6.2f" Normal right-justified financial format with two
digits for cents, aligned on the decimal point.
6. "%c" Converts integer value to character. For example,
65 converts to 'A'. Useful for converting decimal
data to character data (eg, assembly listings).
7. "%02x" Converts integer value to 2-digit hexadecimal. For
example, 65 converts to 45h.
EXAMPLE. Make an ASCII table from 33 to 46.
Method: Set up for this example by setting the "Set math format" on
the "WORD" menu to "%c" and choose integer (1) data. This example
explains why there are two expression evaluators, not just one.
32
Insert 32 on line 1 and move the cursor to the 33 !
start of line 2. Start a macro on line 2 that 34 "
does the following. First, go up one line. Start 35 #
"Fill phrase string" on the "WORD" menu. Press 36 $
key END to grab the token 32 off the screen, 37 %
then insert '+1' and press Ctrl-O,i to evaluate 38 &
the expression (it should be 32+1) to 33. Press 39 '
RETURN two times, once to exit the phrase fill 40 (
and once to go to the beginning of line 2. Then 41 )
press Ctrl-OV to insert the phrase. Press TAB, 42 *
Ctrl-O,k and Ctrl-OV to insert the converted 43 +
expression, which will be '!'. Press RETURN to 44 ,
get the cursor at the start of line 3. End the 45 -
macro. Each press of the macro key adds one 46 .
more line to the ASCII table.
SciCalc ON PHRASE STRING
Calls function calculator() to treat the current text in the
phrase string as a calculator problem. This special function must be
compiled into PI using the source vee.c (ee==expression evaluator).
USAGE. The principal service intended was to produce formatted numeric
output, especially for scientific problems involving math functions
like sine and cosine. Naturally, this one handles parentheses, but
also it supports the definition of variables on the fly and the use of
compiled functions like sine and cosine. That means answers can be
saved and recalled for a later computation.
The author of the basic evaluator is Mark Morley and the copyright for
vee.c dated 1992 belongs to Mark. The documentation is reproduced here
for convenience.
Examples:
1+1
10 * (x=5) <== Assigns 5 to X first!
((1/3) * sin(45))^2
X=50
Y=100
z=hypot(x,y)
[these are disabled in PI]
EXIT Exits the program.
VARS Shows a list a variables and their values.
CONS Shows a list of constants and their values.
CLR Erases all variables.
Constants
pi 3.14159265358979323846
e 2.71828182845904523536
Functions
sin(x) sine function, argument in radians
cos(x) cosine function, argument in radians
tan(x) tangent function, argument in radians
asin(y) inverse sine function
acos(y) inverse cosine function
atan(y) inverse tangent function
sinh(u) hyperbolic sine function
cosh(u) hyperbolic cosine function
tanh(u) hyperbolic tangent function
exp(u) exponential, base e
log(u) logarithm base e
ln(u) logarithm base e
log10(u) logarithm base 10
sqrt(u) square root
pow(x,y) raise x to power y
floor(u) round down to nearest integer
ceil(u) round up to next integer
fmod(x,y) float remainder of x/y
abs(u) absolute value
hypot(x,y) square root of x^2+y^2
deg(u) convert radians to degrees
rad(u) convert degrees to radians
oct(u) convert octal u to base ten
bin(u) convert binary u to base ten
ans last answer
This routines handle the following operators in
order of priority:
1) Anything enclosed in ()'s, variables and functions.
2) Unary + and - signs
3) To the power of symbol: ^
4) Times (*), divide (/), and modulus (%)
5) Plus (+) and minus (-)
6) Assignments (=)
Error messages
E_SYNTAX (1) Syntax error
E_UNBALAN (2) Unbalanced parenthesis
E_DIVZERO (3) Attempted division by zero
E_UNKNOWN (4) Reference to unknown variable
E_MAXVARS (5) Maximum variables exceeded
E_BADFUNC (6) Unrecognized function
E_NUMARGS (7) Wrong number of arguments to function
E_NOARG (8) Missing an argument to a function
E_EMPTY (9) Empty expression
EXAMPLE. Compute the monthly deposit required to have $25000.00
in the bank after 30 years, assuming 7.5 percent interest
compounded monthly.
Solution:
The expression calculator is applied to each equation below.
r=(7.5/100)/12 # 7.5% per annum compounded monthly
n=30*12 # 30-year loan
g=(1+r) # growth factor
v=25000 # value in 30 years
p=v*r/(g^(n+1)-1) # Payment
18.42 # Monthly payment
# Explanation of the formula.
# Each payment has a different term. We have to add a geometric
# series in order get a simple relation between the value (v) and
# the payment (p).
# v=p*g^n + p*g^(n-1)+ ... + p*g^0
# v=p*(g^(n+1)-1)/(g-1))
# p=v*r/(g^(n+1)-1)
EXAMPLE. An auto has sale price of $9000.00. It is to be financed at 9
percent interest compounded monthly for 7 years. Find the
monthly payment.
Solution.
Each month, interest is due on the unpaid balance, plus a payment to
reduce the balance, in such a way that the balance is paid off after 7
years.
n=12*7 # 12 months per year for 7 years
r=(9/100)/12 # Interest rate per month
p=9000 # Balance to pay off in 7 years
It is clear from the equal payment theory that p/n=107.14 is a minimum
payment. This is the figure for zero interest. Interest increases the
monthly payment.
UNEQUAL PAYMENTS.
One method for payment is to pay the amount 107.14 plus the actual
interest on the unpaid balance. The first month would be 107.14 plus
p*r=67.50 for a first payment amount of 174.64. However, the balance
is reduced by 107.14 only, and the next month the payment is 107.14
plus (p-107.14)*r=66.70 making second payment 173.84.
EQUAL PAYMENTS.
Nobody likes the weird payment scheme, so the banks enforce an equal
payment policy:
Equal payment c of principal plus interest
Unequal principal payments x1+ x2 + ... +xn = p
Unequal interest payments p*r, (p-x1)*r, (p-x1-x2)*r, ... , (xn)*r
x1=c-r*p
x2=c-r*(p-x1)=c-r*(p-c+p*r)
=c*(1+r) -r*p*(1+r)
=(c-r*p)*(1+r)
x3=c-r*(p-x1-x2)=c-r*(p-(c-r*p)-(c-r*p)*(1+r))
=(c-r*p)+r*(c-r*p)+r*(c-r*p)*(1+r)
=(c-r*p)+r*((1+r)^2-1)*(c-r*p)/r
=(c-r*p)*(1+r)^2
Add these up and set the result equal to p. Then sum the geometric
series again to give the compact relation
(c-r*p)((1+r)^(n+1)-1)/r) = p
To solve for c, let q=1-(1+r)^(-n-1), then
c=r*p/q=143.58
Payment k pays principal xk=(c-r*p)*(1+r)^k and interest c-xk.
Principal paid Interest paid Actual payment
x1=76.65 c-x1=66.93 c=143.58
x2=77.22 c-x2=66.35 c=143.58
x3=77.80 c-x3=65.78 c=143.58
HEXTOBASE10 on PHRASE STRING.
This function applies a hex to decimal conversion of the phrase
string, replacing the phrase string. It also works on the Enterkey
prompt. Leading characters like 0x or x are allowed. Any trailing
character causes a break and finally conversion, so extra junk can be
on the line.
OCTTOBASE10 on PHRASE STRING.
This function applies an octal to decimal conversion of the phrase
string, replacing the phrase string. It also works on the Enterkey
prompt. Leading characters like 0 or \ are allowed. Any trailing
character causes a break and finally conversion, so extra junk can be
on the line.
PUT WORD OR PHRASE IN NOTEPAD.
To append the phrase buffer onto the NotePad:
Cursor position is irrelevant. Ditto for INSERT mode.
Choose "Add phrase to notepad" on the "WORD" menu. The action is
immediate: the contents of the phrase buffer are appended to the
NotePad. All such appends add to the last group in the notepad
(numbered as group 1, physically the last group in the notepad).
Each append creates one new notepad line.
The phrase buffer is loaded on purpose (by you) and usually
contains short inter-line phrases or words. Appending phrases to
the notepad is a common method of collecting boilerplate text.
BLOCK MARK AND SETUP.
Position the cursor at the first line. The character position is
irrelevant for organization by lines. If a matrix is to be defined,
then position the cursor to the upper left corner of the matrix of
text. A `matrix' is a block of text consisting of rows and columns.
Incomplete rows of a matrix are by default padded with spaces.
Choose "Begin block set mark" on the "BLOCK" menu. Move the cursor to
the end of the block. For a line block the character position of the
line is irrelevant. However, for a matrix block, the cursor must be in
the lower right corner of the matrix.
To view the block defined in inverse video, select "Reveal block
setup" on the "BLOCK" menu. Alternatively, select "Swap mark with
cursor" to see the extreme ends of the block without inverse video.
A second application of "Swap mark with cursor" will invoke "Reveal
block setup". In practise, this is done with a key sequence: ctrl-KK
for Wordstar and ctrl-XX for emacs.
Some extreme cases. On a single line block markup doesn't make a whole
lot of sense. They are other editor operations that work better.
Investigate other items on the "BLOCK" and "WORD" menus. For example,
copying a line should never be done with block operations, because
there is a builtin feature for copying one or more lines.
SWAP BLOCK MARK.
To place the cursor at the other end of the marked block choose "Swap
mark with cursor" on the "BLOCK" menu.
The original mark becomes the cursor position and the current
position becomes the mark. Visually you will see the cursor move
which is enough to delimit the corners of the block. This feature is
present in Emacs and remains valuable for text editing on a slow
modem line.
A second application of "Swap mark with cursor" will invoke "Reveal
block setup". In practise, this is done by repeating the key sequence.
The two views of "Reveal block setup" are (1) By lines, (2) By matrix.
One of these is the default and the other is selected by pressing
SPACE at the prompt. The default remains until changed.
REVEAL BLOCK SETUP.
To see in inverse video the two possible block markups for the
current mark choose "Reveal block setup" on the "BLOCK" menu.
The first display is by lines and the second is the matrix or row and
column display. No action is taken from the displays other than to
show you what the current block is supposed to be.
The two views of "Reveal block setup" are (1) By lines, (2) By matrix.
One of these is the default and the other is selected by pressing
SPACE at the prompt. The default remains until changed.
BLOCK COPY
Assume the block has been defined (see above). Press the MENU key and
select "BLOCK". Choose "Copy block to notepad". The defined block
will be outlined in inverse video. The line block is presented first,
then the matrix block by pressing SPACE. Choose whichever one you want
copied to the notepad.
The block remains defined and no screen text is altered. The outlined
block is copied onto the end of the notepad as a new record. It will
be the first record presented by a paste operation. See below.
BLOCK MOVE
A block move is completed by doing first a block delete and then a
block paste. See below for block delete. This is normally called
"cut" and then "paste".
BLOCK DELETE
To delete the block into the notepad select "Move block to notepad" on
the "BLOCK" menu. The block will be outlined in inverse video.
Confirmation is required before the block vanishes from the screen.
The first display will be the line block, and if skipped, a second
display, the matrix block, will be presented.
The block is appended to the notepad as a new record. It will be the
first record presented for a paste operation.
The block can be either a group of adjacent lines or else a
rectangular matrix with blank-fill on the right. There is no provision
for other kinds of blocks. See the mouse operations for special cases
that can be done easily outside of the editor.
ERASE BLOCK NO SAVE
To delete a block of text without saving it in the notepad apply
"Erase n lines" on the "EDIT" menu. Sorry, no matrix erase unless
saved also to the notepad.
PASTE BLOCK
Move the cursor to the new location where you want to place the copy.
The copied text can be viewed as a matrix or as lines of text for
purposes of the copy.
The default (matrix or lines) is set by the last type used for a
copy. The initial default is lines, but this default is changed by
the first and subsequent copies. PI remembers what you did last and
uses that style as the default.
MATRIX: The lines in the notepad are all the same length. If not
true, then the paste will be aborted on the first line that
has unequal length. The editor will not offer a matrix
paste unless the line lengths match for the entire block.
If you need to fix a block in the NotePad, then add blanks
to the ends of lines until they all have the same length.
LINES: The lines in the notepad are of possibly unequal length.
This operation always succeeds.
When pasting lines the cursor position determines the line only.
Blank lines are opened at the cursor position to insert the lines
from the notepad.
When pasting a matrix, the cursor position determines the upper left
corner of the matrix. This operation never inserts lines. It inserts
columns. The operation never destroys screen text.
When pasting in over-write mode, the rules are the same as for a
matrix paste, except that any characters in the way get over-written.
This is perhaps dangerous but nevertheless useful.
A status query appears for the paste method: lines, matrix,
write-over matrix. If none is chosen then the paste fails and nothing
happens. Otherwise:
The last notepad record (most recent delete or copy) is presented
first, for approval (in write-over matrix mode the last record is
used and there is no option). If it is not the one you want, then
answer the status line query with either 'N' to Quit or 'P' for
previous record. All notepad records can be cycled onto the screen in
this fashion.
The writeover mode, supplied for convenience, should be used rarely.
It destroys screen text forever. It is generally acceptable to do
this operation when the paste will write over a blank portion of the
screen. Mistakes are unrecoverable if the screen text is not blank.
Uses: shifting columns, inserting diagrams into an outline block.
DISCARD NOTEPAD CONTENTS.
To clear the NotePad select "Erase the notepad" on the "BLOCK" menu.
There is no warning message nor confirmation. The notepad is a
scratch space.
The key mapped to this operation is useful to memorize, especially if
you expect to do a lot of boilerplate collection. It can be used from
any buffer including the notepad to wipe clean the notepad contents.
WRITE NOTEPAD TO DISK FILE.
To save the entire NotePad to a disk file:
Choose "Find window" on the "FILE" menu and edit the NotePad.
Decide if you want to remove the ctrl-A record separators (usually
yes). If so, then use Query-Replace to rid the buffer of these
unsavory characters.
Choose "Save to disk" on the "FILE" menu. Enter an appropriate file
name.
The main use of the NotePad as a file buffer is for editing
makefiles. The procedure is this: erase the notepad, inject the
makefile, edit, save. In this process no ctrl-A characters are
spuriously added.
MAKE EDIT WINDOW WITH NOTEPAD CONTENTS.
To make a new edit window with the notepad contents, for editing or
saving as a disk file:
Choose "New" on the "FILE" menu.
Choose "Paste block from notepad" on the "BLOCK" menu.
Copy in the notepad records desired. If YES is the answer to all
status prompts, then all records in the notepad are copied, in
proper order (no ctrl-A record separators are copied).
If the intent is to copy a large number of blocks from the notepad,
then it is advisable to edit the notepad and remove the undesirable
text and/or record separators.
DUPLICATE LINE ONTO NOTEPAD.
To duplicate the current line and append it to the last group in the
notepad choose "Dup line onto notepad" in the "BLOCK" menu.
The operation creates a new line in the notepad but does not alter
the current buffer contents or the cursor position. The last group in
the notepad is unchanged except for one more appended line.
DELETE LINE ONTO NOTEPAD.
To delete the current line and append it to the last group in the
notepad choose "Kill line, add to notepad" in the "BLOCK" menu.
The action is identical to "Delete line" on the "EDIT" menu except the
line is not added to the current save group. Instead, it is appended
to the notepad in a manner described above.
INITIAL TAB AND MARGIN SETTING.
To set the initial TAB amount (default 8 columns), choose "Tab and
margin" on the "VALUES" menu. To change the TAB amount enter a number
and press RETURN, or else enter '.' to choose the tab amount
determined by the cursor column.
The TAB setting is not to be confused with the DETAB setting of 8,
which is used to remove tabs (ascii value 9) from text as it scrolls
onto the screen.
To set the wrap, reform and centering margin, choose "Tab and margin"
on the "VALUES" menu. Skip the TAB prompt. Enter the amount for the
margin prompt or a period. The period implies the margin should be
set at the current cursor position.
The simplest use is to inspect the current settings: respond to each
prompt with RETURN.
TAB INSERTION.
To put tabs into the file, then turn off the DETAB toggle before
editing begins. See "Detab" on the "VALUES" menu.
Tabs are entered as the quoted entry key (ctrl-V or ctrl-P) followed
by ctrl--I the TAB key. They show up on the screen as the letter `I'
in inverse video. Some terminals do not display inverse video well:
adjust the terminal brightness control until properly displayed.
SET DETAB AMOUNT.
To set the tab stop for detab operations, press the MENU key and move
to "VALUES". Choose "Detab" and press RETURN. Enter the number for
the tab stop (2,4,8,16,32). Execute "Detab" again to turn on DETAB
(inspect the setting also!).
DETABBING FILES.
To fully detab a file, insure DETAB MODE is ON. The status of DETAB
is obtained by applying the toggle twice. To execute the toggle apply
"Detab" on the "VALUES" menu.
Physical detab occurs by a scroll from top to bottom. Holding down on
the "Page ahead" key ought to do it. Reverse scrolling also works.
Most persons want DETAB turned ON at all times, and do not wish to be
bothered with the details. That is why the default startup of PI has
DETAB turned ON. See the file $PIE/SYSpi.rc for startup changes.
TABS IN MAKEFILES.
It appears that the only common use of tabs in source files is the
Makefile. For such files the location of the tab is important:
changing it to spaces is not allowed. On the "VALUES" menu the item
"Detab" changes the way in which the editor handles tab characters.
Each use of the item toggles the state of the tab handling. In
addition, the conversion can be set to 2, 4, 8, 16, 32 spaces per
tab character.
A convenient way to edit makefiles is to clear the notepad, inject
the makefile, edit and save. The notepad does not process tabs and
it does not alter spaces at end of line.
SET IMPORT AND EXPORT FILE TYPE.
To set the file type used for importing and exporting text choose
"Export-import" on the "VALUES" menu. Choose 1=Ms-Dos, 2=MacIntosh,
3=Unix. Both the input and output file types can be set. Pressing
RETURN in the query causes the old value to be used (it appears in
closed brackets).
The line termination rules are as follows:
MS-DOS Carriage return and linefeed (13,10 decimal).
MAC Carriage return (13 decimal).
UNIX Linefeed (10 decimal).
BLOCK READS FROM DISK.
To set the disk input mode to special **BLOCK MODE**, choose
"Export-import" on the "VALUES" menu. Choose value 0 or 1 at the
prompt "Block read [0]:", where 0 is normal byte read and 1 is block
read.
Block read mode prompts for the starting block and the number of
blocks to read. See "Information" on the "BLOCK" menu for the
blocksize that is used for disk reads. Generally it is 8k or 16k
bytes. The actual number of bytes read is always less than the
blocksize.
The prompt for starting block assumes start=1. The prompt for number
of blocks assumes number=0, which means "read the whole file".
The special block mode is used on very large files to extract or
inject a chunk of the file.
PRINT SETUP
Choose "Printer" on the "VALUES" menu to set the defaults for print
formatting and the physical printer to be used. The options to be set
are:
Left spaces: Number of spaces inserted on the left edge.
Top blank lines: Number of blank lines inserted at the top of
each page.
Bottom blank lines: Number of blank lines added on the end of
each page.
Text lines per page: The number of lines of text used. The total
of the top and bottom blank lines plus the number of text lines
should equal 66 for a normal printer on 8.5x11 paper.
Use formfeeds: A value of 1 means yes, 0 means no. If yes, then
a line is added after each page containing a single formfeed
character ctrl-L. A formfeed normally ejects the page on a
printer. On some printers it produces an extra blank page.
Experiment to see how useful it might be.
Default printer: For MSDOS the default printer is PRN. For unix
it means the program lpr using the value of environment variable
PRINTER. In the case of MSDOS, the printer device can be used
like a file name, so there is no need to provide a switching
mechanism. The default printer is set by the mode command in
DOS. Printer switching is done by the PRINTER environment
variable in unix.
For unix, do not assume the print program is selected for you.
There is a print filter $PIE/printfilter used by default in
or PI uses the one in your home directory called `.printfilter'.
The print filter gets its file name argument from PI, which runs
the shell script.
BACKUP TOGGLE.
To toggle the state of the backup feature choose "Backup modes" on
the "VALUES" menu. There are three options:
0: Backups off
1: Backup in $HOME/PIbackups
2: Backup in ./PIbackups (current directory)
if that subdirectory already exists.
Otherwise, resort to $HOME/PIbackups.
The backup routine for unix and MSDOS munges the original file name
by replacing period by '\#' and using a hex sequence number for the
last 4 letters of the file name (3 of which are extension). In
practise this works well because the backups are numbered
consecutively from 0001.
The printer and all tty devices are not subject to the backup feature
(they are unplugged from backup rules as encountered).
BACKUP DISABLE.
Because editing on a floppy means disk space is at a premium, the
backup feature is disabled from the toggle "Backups" on the "VALUES"
menu.
PI handles tty backup toggles automatically. The tty backups are easy
to turn off automatically because the file name says it all.
This is almost true for floppies, but there are times when backups on
the floppy are appropriate. PI does not fool with floppy backups.
The file PI.SET can toggle the backups depending upon where PI is
started. If you start PI from a subdirectory where backups are OFF by
default (as set in PI.SET in that subdirectory), then the mode is
preserved for floppies that happen to be edited subsequently.
TOGGLE INSERT MODE.
To toggle insert mode choose "Insert mode" on the "VALUES" menu.
Usually this toggle is mapped to the INS key or KeyPad7. WordStar has
it mapped to ctrl-V also. Insert mode inserts characters in the line,
pushing old characters to the right. Press the toggle key again to
turn it off. Status of the insert toggle appears on the status line
as `[Insert]'.
TOGGLE HIGH STRIP.
To toggle high bit--stripping as is required for WordStar source
files, or files with extended characters choose "High strip" on the
"VALUES" menu. It works like detab, as lines pass across the screen,
and either forward or reverse scrolls will strip the 128--bit.
This mysterious feature is used to read under unix a file made under
MSDOS using IBM graphics characters such as the box-drawing set. Many
IBM vendors distribute documents that utilize the IBM graphics
characters.
INSERT EXTENDED CHARACTER.
To enter extended characters into the text, Ascii codes 128-255,
press ctrl-O,ctrl-E, just to the right of the character to be
converted.
On MSDOS machines, codes 129-255 can be entered directly via the ALT
key. The procedure: hold down ALT and type the ASCII code (in
decimal) on the application pad. When the ALT key is released the
extended code will appear on the screen at the cursor position.
TOGGLE AUTO INDENT.
To toggle auto--indent mode choose "Auto-indent" on the "VALUES"
menu.
This mode is not sophisticated so expect to use it with reform:
"Justify line" on the "EDIT" menu.
Auto indent is usually ON when the editor starts. Check defaults so
that you know the wakeup mode.
There is a collision between auto indent and X-windows: a copy of
more than one line of text will not paste as expected unless auto
indent is OFF!
TOGGLE STATUS LINE.
The four modes are set by choosing "Status line" on the "VALUES"
menu. Each such select changes to the next mode finally returning to
mode=1 (normal).
The status line toggle switches between these four modes:
1. File number, file name, insert mode display, line number,
cursor position.
2. The above but remove the line numbers and cursor position.
This is primarily made for modem use.
3. ASCII chart for the cursor character replaces the status of
item 2 above, unless beyond end of line, where it reverts
again to item 2. This can be invoked directly from "Ascii
reveal codes" on the "OTHER" menu.
4. Blank status line.
TOGGLE WORD WRAP MODE.
To toggle auto--wrap mode press the MENU key and move to "VALUES".
Choose "Wordwrap" and press RETURN.
This mode uses the right margin setting to determine when to spill
characters over to the next line. It is best used in combination with
Auto-indent mode and the Justify line command. With the modes set
properly it is possible to compose a paragraph without using the
RETURN key at all. Ditto for paragraphs with hanging indent.
TOGGLE HANGING INDENT MODE.
To toggle hanging--indent mode, turn on auto--wrap, auto--indent and
insert modes, and the hangin-indent mode. In this mode, reform occurs
at the indent of the previous line rather than at the left margin. It
mostly affects typing, where hitting return results in the cursor
moving to the correct position on the next line, rather tahn just to
the left margin.
INITIAL STARTUP WITH FILE LOAD.
To load in a file as PI is invoked:
At the system prompt, type PI and a space, but don't press RETURN.
Type the complete file name, which may include a path name, and
press RETURN. Wildcards may be used. More than one file is allowed.
Example: pi paper.tex chap*.bib intro.???
LOAD NEW FILE.
At least 40 files can be edited at once. The number is set in the
startup file PI.SET (or .pirc) on the line
info-max-size=40
To load another file while PI is running:
Press the MENU key and move with cursor keys to "Open".
Press space or return.
Two options exist:
1. Press the RETURN key to get a list of possible file name. To
choose one, move to it with the cursor keys and press RETURN.
The directory on the status line can be edited and wildcards
can be added to simplify the resulting list of file names.
2. At the prompt for a file name, enter the complete file name or
a partial file name and the TAB key to complete the file name
(if possible). Duplicates may exist. If not, then PI will
complete the file name. Otherwise, the name is completed with
wildcards and you may press return to get a subwindow of file
names that match the given wildcards.
Shortcut: To erase a long pathname, add // to the end and
press TAB. Only the root will remain.
The old file you are editing is not lost. The "FILE" menu commands
"Forward a window" and "Back a window" change the edit window to a
previous file. About 100 files can be kept in the editor at one time
under unix or MSDOS.
NEW UNTITLED WINDOW.
To create a new window called "UnTitled" choose "New" from the "FILE"
menu. The actual file name will be determined by prompt when exiting
PI or when an attempt is made to close the file.
RENAME FILE.
To rename or change the name of a file buffer choose "Rename" on the
"FILE" menu. A prompt will appear for the new name. The name is
checked against names on the disk to prevent accidental destruction
of existing files. See also the section on backups for recovery of
previous versions of files saved by PI.
SAVE FILE AND CONTINUE.
To save the current edit and continue editing the file, choose "Save
on disk" from the "FILE" menu. If backups are turned on, then the
previous version is saved as a backup with new name. The current
version carries the name on the status line. If anything goes wrong,
such as running out of disk space, then a warning appears on the
status line. In any case, the previous version on disk is not lost.
In the unix version, several failures at trying to save the file will
put a copy in the /tmp directory. Often this directory is on a
different physical disk. Incidents like this are common on systems
that have a large number of users and less than 10 percent free disk
space.
SAVE AS ....
If the edit window says `UnTitled' or `NotePad', then a file name
must be supplied during the save. This command also applies to save
an edit under a new file name. To use file name XXXXXXXX:
Press the MENU key and move to the "FILE" menu. Highlight "Save as ..."
and press return. The status line prompt will appear requesting a new
file name.
Enter XXXXXXXX on the status line. Sometimes the directory name needs
editing (backspace or delete will work). If XXXXXXXX already exists,
then the typing of the name can be avoided by pressing RETURN on the
status line to bring up a file list.
Press RETURN to save the file (ENTER key aborts). If unlucky and the
file name is already in use, then a prompt appears to allow or
disallow over-write.
DISCARD EDIT.
To discard the editing session (one window at a time), press the MENU
key and move to the "FILE" menu. Choose "Close" and press RETURN. If
the message "Discard edit?" appears, answer Y. If the edit was made
to a disk file that already has contents, then that file is unaltered
and only the current edit changes are lost. If the disk file did not
previously exist, then all changes are lost.
To discard all edits, quit PI from the menu and look carefully at the
list of changed buffers. If nothing dangerous is listed, then go
ahead and exit permanently (job ends). Each new copy of PI starts
with one buffer for the NotePad and one buffer for UnTitled.
SAVE FILE AND CLOSE
To save the file being edited and discard the edit window for that
file, press ctrl--KD. Compare this to save and exit, ctrl--KX, which
leaves the edit buffer intact, saves the file, and immediately
suspends PI (suspend leaves the editor resident so that fg and %n
commands resume editing) or else exits PI permanently (MSDOS).
In any case, ctrl-KD leaves the editor running.
SAVE FILE AND EXIT.
To save a file and exit PI (EXIT suspends PI, QUIT kills the job),
press the menu key(s) and move to the "FILE" menu with the cursor keys.
Highlight "Exit after save". Press RETURN or SPACE to make it happen.
UNIX. The editor is suspended and may be restarted with the `fg'
command. Don't restart PI with the INITIAL STARTUP (see above)! Use
the `jobs' command at the unix prompt to see which jobs are
suspended: these jobs can be resumed where you left off.
MS-DOS. Here, "EXIT" and "QUIT" mean the same. To get the equivalent
unix behavior, choose "Save to disk" from the "FILE" menu, then "Swap
pi and shell" from the "QUIT" menu. You can set this behavior in
PI.SET with the control string
suspend.on.exit=1; Suspend PI on SAVE THEN EXIT ctrl-KX. MSDOS (0)
READ FILE INTO TEXT.
To inject a file into the text:
Position the cursor to the line where the text is to be copied.
(Inject works like multiple insert line)
Press the MENU key and move to "FILE". Choose "Inject file" and
press RETURN.
Enter the name of the file to be inserted at the cursor and press
RETURN. A file lookup may be done here by using the file name
completion key TAB. A list of files appears if RETURN is used for
the file name.
NOTES: To insert part of a file, set up for "Block read" by choosing
"Export-import" on the "VALUES" menu, then select value 1 for block
read. You will be prompted for the start block and number of blocks
to read. The block size is determined by the block size used in the
editor, usually 4k or larger. See the "Information" display on the
"OTHER" menu.
Inject occurs by lines only, and the current line will be the
first line after the injected file.
Columnar injects may be done by pasting the notepad buffer. The
usual process is to inject a file into the NotePad, edit it, then
do a columnar inject into another edit buffer using "Paste block
from notepad" under the "BLOCK" menu.
FILE SIZE LIMITS.
The file size limit is determined by three variables in PI.SET:
xms.maximum.blocks=512; Largest number of xms blocks in use (512)
string.reserve.blocks=6; Mem blocks reserved for internal line copying (6)
block.buffer.size=4; Size in kilobytes [2..10] of low/xms memory buffer (4)
Each XMS block uses SIZEBLOCK bytes. A setting in PI.SET such as
block.buffer.size=4
results in BLOCKSIZE=4*1024 bytes. The total number of blocks is the
sum of blocks available in the transient program area (tpa,640kb max)
and the number MAXXMS set by default in PI.SET by the line
xms.maximum.blocks=512
This example sets MAXXMS=512. The MSDOS line (not used in unix)
string.reserve.blocks=6
loads a variable STASHmin=6. The object is to reserve tpa string
space of STASHmin*BLOCKSIZE=6*4096 (24kb) for strings. If the tpa is
480kb, then about 118 blocks are available there, reduced by 6 to
112, making a total of 512+112=624 blocks. Then the file size limit
is approximately 2,555,904 bytes (2.5mb).
ADJUSTMENTS. Changing the block size from 4 to 6 makes a big change
that affects little except the file size limit. MSDOS and unix have
different block size limits. A good working rule is to limit the
MSDOS block size to 8k. Unix should start with a block size of 8k
or 16k and not exceed 32k.
The number N of XMS blocks is used to create a large array in the
tpa of size 18N bytes. Assignments like N=2500 cause the
consumption of 45,000 bytes (44k) in the tpa. If N=65536, then
array consumption reaches 1,179,648 (1.1mb) which is larger than
the tpa itself (impossible). The MSDOS limit of about N=25,000
gives a file size limit of 267,960,320 bytes (255mb). This does not
apply to unix. Both systems will certainly use virtual memory to
reach the limits. In a practical sense, the file size is limited by
physical memory or RAM.
OLD MSDOS SYSTEMS. The version of HIMEM.SYS should be 2.0 or higher.
The best driver is dated 1988 (ver 2.04) or later and it is freely
available for downloading from
http://www.microsoft.com/
together with the Microsoft xms specs (xms20.txt, xms30.txt). The
driver shipped with windows 3.1 is version 3.xx and it has some
especially interesting setup features, such as a memory test and the
ability to increase the number of xms handles from the default 32 up
to 128 (not needed in PI).
HANDLING LARGE FILES.
The remarks below apply primarily to the PC version of the PI editor
which is in its minimum configuration limited to a capacity of about
500 kilobytes (see FILE SIZE LIMITS, above).
Block move functions can do this very well, if you have enough memory
to load the file. The method below is an alternative which makes it
easier to create files of about the same size. To use the block move
method on minimal hardware, set up MS Windows with a large disk swap
and run PI from a DOS window. If you have 1mb memory or less, then
the method below may be the only alternative.
LOAD BLOCKS.
To load blocks 2 through 10 of file SAMPLE.TXT:
Choose "Export-Import" on the "VALUES" menu.
Skip the first two prompts. Set "Block Read" to "1".
Choose "Open" on the "FILE" menu.
Enter: SAMPLE.TXT
Press RETURN.
The file name will be changed to UnTitled to avoid writing out a
short version of the file to the original file name. You will be
prompted for the following information:
Start block: [1] <== Enter 1 for the first block
Count: [0] <== "0" means the whole file, but "1"
means just one block will be read.
Enter 9, because that is how many
occupy blocks 2 through 10.
INJECT BLOCKS.
To read in blocks 5 through 10 of file SAMPLE.TXT at the cursor:
Position the cursor to the line where the text is to be inserted.
Choose "Export-Import" on the "VALUES" menu.
Skip the first two prompts. Set "Block Read" to "1".
Choose "Inject file" on the "FILE" menu.
Enter: SAMPLE.TXT
Press RETURN.
Repeat the previous example, answer the prompts as "5" and "6",
respectively.
BREAK A LARGE FILE INTO SMALL FILES.
To break up a large file of size 2400k (2.4mb) into multiple small
files. Assume the editor has 8k blocks. Then 300 blocks or more must
be read. Proceed as follows:
Read in blocks 1-50 by the method of the item above.
Write out the file to a new name, e.g., BIG.1, using "Save on
disk" on the "FILE" menu.
Repeat the above successively for pages 51-100, then pages
101-150, 151-200, etc.
The output files BIG.1, BIG.2, etc, from this procedure will be
about 400k bytes each. If you need to put them back together again,
the use the system copy command or inject the files inside PI into
a single file.
MAKING A UNIX BATCH FILE.
To make a shell file (batch file) that copies files to directory
/tmp:
Choose "New" on the "FILE" menu to get a new edit buffer. Insure
insert mode is ON. Then press choose "Paste directory" on the
"OTHER" menu.
Enter the wildcard file name.
Example: *.c
Press RETURN to inject the file names into the edit buffer.
Now that the file names are in the edit buffer, we write a short
macro to make the shell file.
Position the cursor to the top of the file list.
Choose "Memorize keys" on the "Keys" menu to start memorizing.
Type characters `c', `p', ` ', then go to the end of the line using
an editor key (END, R5, ctrl-RIGHT, ctrl-E are some of the usual
keys), then characters ` ', `/', `t', `m', `p' and finally a
carriage return.
Press the key suggested on the status line to end the memorizing
step. This completes one line of the set.
For each additional line, choose "Replay keys" on the "Keys" menu
(or the corresponding key).
Example: Enter wildcards `./*.c'
BEFORE MACRO AFTER MACRO
---------------------------------
where.c cp where.c /tmp
v1.c cp v1.c /tmp
make.c cp make.c /tmp
touch.c cp touch.c /tmp
fgrep.c cp fgrep.c /tmp
Save the file using "Save on disk" on the "FILE" menu with name
`test.sh'. At the Unix prompt, issue the command `chmod +x test.sh'.
Finally, type the name of the file at the unix prompt (test.sh). This
will execute the commands in the file `test.sh' as though you had
typed them yourself at the Unix prompt.
FORMAT FILE FOR PRINT.
To format a buffer it must be first saved to disk. The buffer is to
be replaced by one called "Untitled" in which all the format
operations described above have been performed.
To initiate formatting, choose "Print file" form the "FILE" menu. The
formatting and printing can be done separately.
PRINT FILE
To print the file in the current buffer choose "Print file" from the
"FILE" menu. The file can be printed even if it has not been saved on
disk (compare with the format rules above).
MSDOS. On a PC, a print job is a write to a device, normally PRN. If
you want to write to another device, then save the file with that
device name, e.g., com1 or lpt1.
UNIX. The printer name is set by the PRINTER environment variable
using the unix command "setenv". Lacking this setup, choose the
printer name "lpr". The unix action for print is to issue the
following background command:
$HOME/.printfilter filename
If the file $HOME/.printfilter does not exist, then PI uses the file
$PIE/printfilter instead.
PRINT FILTER INTERNALS
The local unix shell script $PIE/printfilter is
enscript -d lpr -B -f Courier12 $1
This print filter depends upon a system program ENSCRIPT of Markku
Rossi which paginates the text and converts it to postscript. To read
its documentation use the unix command "man enscript". The effort of
PI is to supply the command line argument $1 for the file name. The
print filter itself is to be written by the user. On many systems the
shell variable $PRINTER is defined, and that can be substituted in
the filter for the text "lpr". The advantage is that switches of
printer are automatic.
It is an advantage, when enscript is available, to do nothing to PI's
file; let enscript do everything. If this is not possible, then the
pagination and white space controls internal to PI can be applied.
PRINTING PROGRAM LISTINGS AND MAIL MESSAGES.
To print a mail message or program source code file called 'filename'
under unix , use the `lpr' command at the Unix prompt as follows:
lpr filename
The program `lpr' prints on a system printer, in this case, the
printer defined by environment variable PRINTER in the local shell
resource file '.cshrc' or '.bashrc'.
For more information on printing program source and mail messages see
the remarks above on print filter internals.
SUPERB PRINT OUTPUT.
PI is not a word processor like Word Perfect or Microsoft Word. If
you want superb printer output, then learn about LaTeX, NROFF and
TROFF, all of which have manual pages.
For programming purposes the combination of LPTOPS and LPR outlined
above will suffice. For reports and research papers, LaTeX is
indicated, especially if you expect to have mathematical equations,
foreign accented characters, tables and figures.
NEXT WINDOW
PREVIOUS WINDOW
FLIP WINDOWS.
To change edit windows:
FORWARD.
Press ctrl-L.
BACKWARD.
Press ctrl-QL
JUMP RELATIVE.
Press ENTER, enter a positive or negative number, then press
ctrl-L or ctrl-QL.
SELECT WINDOW.
Use the "FILE" menu item "Find window" which is mapped to ctrl-KA.
DISCARD WINDOW.
To discard an edit window, press the MENU key and move by cursor keys
to the "FILE" menu. Choose "Close" and press RETURN. If the edit
window has changes, then confirmation is requested: answer Y to scrap
it (other keys abort).
KILL UNIX PROCESS PI. QUIT EDITOR.
To exit pi permanently choose "Quit editor" on the "QUIT" menu. The
other exits will suspend the editor (fork kept).
To throw away a copy of PI at the shell level in unix:
Resume PI using `fg' or `%n' or `%pi', then exit pi with "Quit".
Alternate method: use the command `kill %pi' or `kill %n' to kill
the job without resuming the edit. If these commands are
unfamiliar, use `man csh' to get a tutorial.
FORKED JOBS.
UNIX. The pi editor will be kept as a forked job, by default. All
normal exits keep the fork. Only the PI 'QUIT' command will kill the
process (the `kill' command under csh will also get rid of pi). To
start unix PI once it is loaded, enter
fg (assuming pi was last job)
or
jobs (note number n for process `pi')
%n
MSDOS. The pi editor will be suspended only in case PI.SET has
variable set "suspend.on.exit=1" because the default (0) is to exit
the editor on "Save then exit" on the "FILE" menu. If the variable is
set, then to
start MSDOS PI after ctrl-KX exit, enter at the MSDOS prompt
EXIT (assuming pi was suspended)
Using the MSDOS key program wced, it is possible to define an alias
for the DOS exit command, making it match unix, for consistency. The
program wced adds some commonly used features of the BASH shell.
DISPLAY INTERNAL INFORMATION
To display the status of setup file options, press the MENU key and
move to "Help". Choose "Internal info" and press RETURN. A display
for Linux in May 2000 looks like this:
Max files : 40 How many files editable at once
Active Files : 2
Max file name: 256 Maximum size of a path name
Blocks in use: 11
Blocks total : 1024 There are 1024 blocks possible.
Block size : 16384 Each block has size 16kb.
Max columns : 384 A line can have 384 columns.
Max rows : 40 Window row maximum is 40 rows.
Columns 0 to : 74 Columns currently used are 0-74.
Rows 0 to : 23 Rows currently used are 0-23.
File size max = 16777216 bytes
Shared Text=172, Private Data=352, Stack=8
TERM=vt100
Keymap=Internal WS Keys
SrcDir=/var/lib/pie49/ Where to find all editor support files.
SetUp=./.pirc The initialization file.
The memory report lists the shareable text size of the application, an
amount that can be mostly swapped out to disk. Some portion of the
unshared data consists of static strings, e.g., menu text. The rest of
the non-variable unshared data comes from calls to malloc(). In the
example above, a file of size 207kb was being edited, which suggests
that 145kb of static strings and malloc() data were used at startup.
The entire 352kb is can be swapped to disk.
DIRECTORY INFO.
Unix path names look like /usr/include/sys/*.h. File names may
contain a path name or wildcard. MSDOS uses path names with
backslash. However, the unix path separator is acceptable as an
argument to an MSDOS program (but unacceptable to command.com as a
program name!).
WILDCARDS.
The wildcard character set is system dependent. Under Unix, `*' is a
multi-character wildcard. The character `?' is a single-character
wildcard. Directory names may not contain a wildcard. MS-DOS uses
the same wildcards as unix.
DIRECTORY PASTE.
A directory request "Paste directory" from the "OTHER" menu pastes
the information at the cursor. You may edit and use the directory
text as though you had typed it.
The directory normally gets emitted in 1-column format. To produce
4-column format add `,4' to the wildcard file name. Example: *.c,3
emits all C language files in 3-column format.
The principal use for a directory paste is to make a shell or batch
file. Another use is to simulate the "dired" feature of emacs for
loading files into the editor or running programs.
DIRECTORY INFORMATION.
To get directory information without pasting to the current cursor
position choose "Open" on the "FILE" menu and enter the starting
directory and wildcards. Press RETURN or SPACE) to get the file list
and end with escape (one or more) to abort the actual file load.
An alternate is to run the unix program `ls'. You may do so by the
following sequence or variant while the editor is running:
ENTER, `ls -al *.*', "Execute program"
LINE AND BOX DRAWING.
To draw lines and boxes choose "Box and line draw" on the "OTHER"
menu. The first prompt will be for the line drawing set. Normally
this prompt is skipped.
The first application of the mode sets line draw mode, in which the
cursor keys are used to draw lines. Other editing keys can also be
used, for example the return and delete key, space, normal text.
To turn off line and box drawing, apply the toggle again on the
"OTHER" menu.
The default line drawing set is determined by the value of variable
`drawing.style' in setup file PI.SET or $HOME/.pirc. A value of 1 is
normal. To see the effects of other values, choose one and experiment
with the cursor keys (the NotePad is a good place to experiment).
ASCII TABLE.
Select the menu OTHER and then "Ascii reveal codes" to display the
Ascii code of the character under the cursor. Selecting it twice
turns it off.
A number of text editors like to display the ASCII table instead.
If you really need an online ASCII chart, then please load the file
CHARS.TXT supplied with this editor package.
RESIZE SCREEN.
To resize the terminal screen or window:
Press the MENU key and move to the "OTHER" menu. Choose "Resize
Window" and press RETURN.
Enter the ROWS (22 normal).
Enter the COLS (78 normal).
A RETURN key keeps the old value. Use "Internal info" on the
"Help" menu to see the range of values possible.
On vt100 terminals, move the cursor off screen up and down afterwards
to reset the scrolling region to the new size.
In MS Windows 3.1, the unpredictability of the window size was a
constant trouble. There seemed to be no way to predict the ultimate
size of the window after launch. PI can react to new sizes manually,
but until it becomes a windows application, no automation is
possible. In Windows 95/98/2000 the window size problem has been
fixed and there is no reason to use resizing.
The main use for window resize is for remote modem connection. A good
size is 10 rows by 72 columns. Another application is a telnet
connection from an xterm window where the remote site does not
support X protocol, or where the trouble involved to set up X exceeds
the user's patience.
DEFINE COLORS IBM-PC.
To set the foreground and background colors choose "Color and menu
setup" on the "OTHER" menu.
The colors of everything can be permanently set in PI.SET. However,
experience showed that finding the right colors is a visual and
experimental process. Therefore, the color set is interactive, so
that experimentation is possible using the monitor and screen size
which will be in use. Other methods like color bar selection have
been tried but they proved to be confusing and not especially
experimental.
The drop-down menus have color assignments also which appear in
PI.SET. Setting these values interactively is clumsy. Instead, try
the color combinations as outlined above, then set the window
attributes accordingly in PI.SET. An exception is the box character
set used for menu edges. The 5 character sets can be selected
interactively from the "Color and menu setup" on the OTHER" menu.
See below for details.
COLOR RULES IBM-PC.
The rules for setting colors on IBM are simple. Choose a background
color using a number 0-7 and then a foreground color using 0-15. If
you choose the same number twice, then the text is invisible.
Otherwise, some contrasting pair of colors should appear. On a mono
monitor not many combinations will be visible.
The rules for obtaining a single integer ATTRIBUTE from the
foreground and background colors:
ATTRIBUTE = (foreground+(background)*16) - 128
dark colors: BLACK=0, BLUE=1, GREEN=2, CYAN=3, RED=4, MAGENTA=5,
BROWN=6, LIGHTGRAY=7
light colors: DARKGRAY=8, LIGHTBLUE=9, LIGHTGREEN=10, LIGHTCYAN=11,
LIGHTRED=12, LIGHTMAGENTA=13, YELLOW=14, WHITE=15
Example: BLACK on LIGHTCYAN uses attribute 48 because
(BLACK+(LIGHTCYAN)*16) - 128 = 48.
Warning: Attributes are in the range 0 to 127. Add 128 to an
attribute to make it blink.
COLORS SETUP PI.SET
The MSDOS file PI.SET contains the following setup lines with
suggestions for color assignments:
other.attributes=7; Screen attribute for edit screens
(7=mono,48=color)
title.attribute=15; Window title attribute flag
(31=boldface,15=mono).
window.attribute=19; Window text attribute
(19=blue /w yellow text,7=mono).
border.attribute=31; Window border attribute flag
(31=boldface,15=mono).
The line character set for the window border can also be set, as
follows:
box.characterset=2; Character set for box border
(0=Text,1=vga1,2=vga2,3=iso1,4=iso2)
The default for MSDOS is 2, double-line VGA characters.
DEFINE COLORS UNIX.
To set the foreground and background colors of menus under UNIX,
choose "Define colors" on the "OTHER" menu.
The colors of everything can be permanently set in ".pirc". However,
experience showed that finding the right colors is a visual and
experimental process. These color sets work only if the terminal is
ANSI, for example, remote connection to a unix host via Kermit.
COLOR RULES UNIX.
To set the foreground and background screen text color of PI under
unix requires a setup of the Xterm window in which PI operates. An
example:
xterm -bg yellow -fg blue -bd black -w 10 -geometry =80x34 &
Other xterm switches, commonly used, may be set in the ".Xdefaults"
source file:
+ah +cn +ls -s -sf -wf -j
Under Linux, with color_xterm, the menus may be set separately in the
file ".pirc". The colors:
30-37 foreground colors: 0=black, 1=red, 2=green, 3=brown,
4=blue, 5=magenta, 6=cyan, 7=white.
40-47 background colors: the same scheme.
0 Use the default colors set by the window system.
The setup lines in $HOME/.pirc are as follows:
ansi.mode.unix=1; Switch coloring mode 1=on, 0=off
tfg.text.fg.color=30;
tbg.text.bg.color=46; Use 0 for the X-windows bg color
mfg.menu.fg.color=37;
mbg.menu.bg.color=44;
box.characterset=0; Character set for box border
The line character set for the window border can be set, as follows:
box.characterset=4; Character set for box border
(0=Text,1=vga1,2=vga2,3=iso1,4=iso2)
The default for UNIX is 0, text characters. Use 3 or 4 if the font is
an iso-8859 font with line drawing characters. Use 1 or 2 for VGA
fonts, e.g.,
rxvt -fn vga -e pi -x &
launches PI in its own color window with vga font to simulate how the
program looks under Win98.
SUSPEND EDITOR.
To suspend PI, no file save:
For unix, use "Suspend editor" on the "QUIT" menu.
For MS-DOS, use "Swap pi and shell" on the "QUIT" menu. For many
years this has been mapped to F2, because it happens often. See
also PI.SET line "suspend.on.exit=1" which sets "File" menu item
"Save then exit" to a mode that emulates unix behavior.
This is the way to exit to the shell and do something else like run a
compiler, leaving your editing intact. Re-enter the editor with the
unix shell `fg' command or `%n' command (`man csh' for details).
The MS-DOS version uses Ralf Brown's (Thanks, Ralf!) SPAWN library to
release all memory used by PI and therefore make available for the
shell full memory. This method can be switched to a regular Turbo-C
library system call with reduced memory, if something goes wrong with
Ralf's SPAWN library. See menu "OTHER" and "Disk swap mode".
SUSPEND EDITOR AND EXIT TO SHELL.
A normal unix exit from PI will exit to the shell, where you can run
programs in a usual manner. The only exit that does not suspend the
editor is "Quit". The normal one for immediate suspend is "Suspend
editor". Both appear on the "Tools" menu.
The command named "Command shell" on the "TOOLS" menu exits the
editor and runs a private copy of the shell (bash under Linux). To
return to the editor, "exit" is required for the spawned shell. This
is sometimes confusing, because "jobs" will not show PI running and
it appears that PI has been trashed. However, some command like PS or
PSTREE will verify that indeed PI has been given a command to run the
shell, so "exit" will return to PI.
SHELL TO UNIX.
To exit to a new copy of Unix csh: press the MENU key and move to
"Tools". Choose "Command shell" and press RETURN.
To return to PI when done, type "exit" at the shell prompt. This
command executes so slowly that it is not recommended. Generally, it
is better and faster to choose "Suspend editor" on the "QUIT" menu,
then use the `fg' command to resume editing.
KEYMAP EDITING
To display all keys and their functions choose "Keymap editor" on the
"KEYS" menu. As you move the cursor through the list, the key
assignment appears on the status line.
To obtain a printed copy of the key list choose "Write pi-dump.key"
on the "Other" menu. Edit this file and choose "Print file" on the
"FILE" menu.
See also the MSDOS program PIHELPB.EXE, which displays common key
maps and keyboard layouts. Under Linux, the same program exists,
called pihelpbu. It can be displayed in an Xterm window or in a
console.
ONLINE HELP.
To get an online help file choose "Full manual" on the "Help" menu.
This runs the help program which displays the document pihelp.doc on
screen. Exit from the help routine restores the editing session.
MSDOS. There is a brief manual of key assignments that can be
displayed from the "Help" menu. This help program is normally bound
to Alt-F1. The full help display is bound to Shift-F1.
UNIX. There is a brief manual of key assignments that can be
displayed from the "Help" menu. This help program is normally bound
to ctrl-QH. The full help display is bound to ctrl-OH. The acronyms
for remembering the keys are "Quick Help" and "Ordinary Help".
PRINTED MANUALS.
The best help is a printed manual.
Print the manual yourself. Sources:
UNIX: $PIE/pihelp.htm
$PIE is /var/lib/pie/ or /usr/local/lib/pie/
MSDOS: c:\usr\PIHELP.HTM
To print the manual, load it into a browser like Netscape and use the
FILE menu "print" option. If a text-only version is wanted, then save
the file in Netscape as "text only" and edit away the top of the file.
RUN PROGRAM.
To run program XXXXXXXX:
Press the MENU key and move to "Tools". Choose "Execute program" and
press RETURN.
Enter XXXXXXXX and press RETURN. When the program exits, you will be
returned to PI.
It is common to run a compiler while in the editor. In this case, the
string XXXXXXXX is the command line "cc filename.c" or some variant.
Naturally, these key strokes can be memorized as a macro to reduce
the repetition.
MACRO IDEAS. A useful extension: Use "Paste directory" on the "File"
menu to put program names in the NotePad. Create a macro: begin with
"Execute program", grab the file name with backspace or Right-arrow,
then press RETURN. Each macro key will run the program at the cursor
position. Example: Run diff on selected pairs of files and collect
results to a single file.
GRABBING TEXT FROM THE SCREEN.
In each of the cases below, a key can be pressed after the string is
finished, which determines the action taken. Usually, the action is
to search for a string, load a file, inject a directory, copy a
substring, or some such task.
SEARCH STRINGS.
To use existing screen text for a search string:
Position the cursor at the desired text.
Press the ENTER key.
Press END for each token you want to capture. Use Right-Arrow to
grab single characters. Corrections are made with DELETE or
BACKSPACE or LEFTARROW.
Previous search strings can be recalled by pressing the SEARCH key
once again and then UPARROW and DOWNARROW to navigate through the
list of 51 saved search strings.
FILE NAMES.
To use existing screen text as a file name:
Position the cursor at the desired text.
Press the ENTER key.
Press END for each token you want to capture. Use Right-Arrow to
grab single characters. Corrections are made with DELETE.
DISABLE FUNCTION KEYS.
To disable a function key make it a duplicate for the NULL key
operation, which is do-nothing for this key. You will find it on the
"Keymap editor" on the "KEYS" menu. Key assignments are listed there.
To assign the duplicate function key, and hence disable that key,
choose "Keymap editor" on the "KEYS" menu.
SUN 3/50 KEYPAD CURSOR MOVES.
+----------------------+
| R1 | R2 | R3 | KEYPAD CURSOR MOVES
|Enter | Menu |PgUp | Press the key to execute
|-------+-------+------|
| R4 | R5 | R6 | ENTER-KEY KEYPAD MOVES
|Lt Edge|Rt Edge|PgDn | Press ENTER first, then the key
|-------+-------+------| +-------+
| R7 | R8 | R9 | | R8 |
|Insert | Up |Delete| |search |
|Toggle |Arrow |Char | |str up |
|-------+-------+------| +------+-------+------+
| R10 | R11 | R12 | | R10 | R11 | R12 |
| Left | Home |Right | | |Reverse| |
| Arrow | Cursor|Arrow | | | Home | |
|-------+-------+------| +------+-------+------+
| R13 | R14 | R15 | | R14 |
|Insert | Down |Delete| |search |
|Line |Arrow |Line | |str dn |
+----------------------+ +-------+
SUN 3/50 LEFT KEYPAD FUNCTIONS.
LEFT KEYPAD FUNCTIONS SUN 3/50
Press the key to execute
+-------------------------+
| L1 | L2 |
|Keymap edit |Run Program |
|------------+------------|
| L3 | L4 |
|Insert Line |Delete Line |
|------------+------------|
| L5 | L6 |
|Search Ahead|Search Back |
|------------+------------|
| L7 | L8 |
|Run Macro |Record Macro|
|------------+------------|
| L9 | L10 |
|Copy Line |Paste Line |
+-------------------------+
MAC PLUS KEYPAD CURSOR MOVES.
+-----------------------------+ MAC KEYPAD
| | = | / | * | EXTREME EDGE AND TOP OR
| Edit |Copy |Paste |Memori| BOTTOM OF FILE MOVES
| keymap| Line | Line |Steps | --PRESS ENTER FIRST--
|---------------+------+------| +----------------------+
| 7 | 8 | 9 | - | | 7 | 8 | 9 |
|Insert | Up |Delete| Page | | |Search | |
| Toggle| Arrow|Char | Up | | |str up | |
|-------+-------+------+------| |-------+-------+------|
| 4 | 5 | 6 | + | | 4 |Reverse| 6 |
|Left |Home |Right | Page | | | Home | |
| Arrow | Cursor| Arrow| Down | | | Cursor| |
|-------+-------+------+------| |-------+-------+------|
| 1 | 2 | 3 | | | 1 | 2 | 3 |
|Insert | Down |Delete| | | |Search | |
| Line | Arrow | Line | ENTER| | |str dn | |
|----------------------| KEY | +----------------------+
|Backward |Forward | | <=== MAC KEYPAD FUNCTIONS
|Search 0 |Search . | |
+-----------------------------+
MAC II/SE KEYPAD CURSOR MOVES.
+-----------------------------+ MAC II/SE KEYPAD
| Full | = | / | * | EXTREME EDGE AND TOP OR
| Key |Copy |Paste |Memori| BOTTOM OF FILE MOVES
| List | Line | Line |Steps | --PRESS ENTER FIRST--
|-------+-------+------+------| +----------------------+
| 7 | 8 | 9 | - | | 7 | 8 | 9 |
|Insert | Up |Delete| Page | | |Top of | |
| Toggle| Arrow|Char | Up | | | file | |
|-------+-------+------+------| |-------+-------+------|
| 4 | 5 | 6 | + | | 4 |Reverse| 6 |
|Left |Home |Right | Page | | | Home | |
| Arrow | Cursor| Arrow| Down | | | Cursor| |
|-------+-------+------+------| |-------+-------+------|
| 1 | 2 | 3 | | | 1 | 2 | 3 |
|Insert | Down |Delete| | | |Bottom | |
| Line | Arrow | Line | ENTER| | |of file| |
|----------------------| KEY | +----------------------+
|Backward |Forward | | <=== MAC KEYPAD FUNCTIONS
|Search 0 |Search . | |
+-----------------------------+
WORDSTAR LAYOUT FOR STANDARD QWERTY KEYBOARD.
+--------------------------------------------------------------------+
| Q | W | E | R | T | Y | U | I | O | P |
|quick |line |up |prev |erase |delete|abort |tab |option|ctrl |
|prefix|up |arrow |screen|right |line |key | key |prefix|insert|
+--------------------------------------------------------------------+
| A | S | D | F | G | K | L |
|left |left |right |right |delete|file |next | WORDSTAR KEYS ARE
|word |arrow |arrow |word |char |prefix|window| EXECUTED BY HOLDING
+------------------------------------------------+ DOWN THE CTRL KEY
| Z | X | C | V | B | N | AND PRESSING THE
|line |down |next |insert|reform|insert| INDICATED LETTER
|down |arrow |screen|toggle|lines |line |
+-----------------------------------------+
EMACS LAYOUT FOR STANDARD QWERTY KEYBOARD.
+--------------------------------------------------------------------+
| Q | W | E | R | T | Y | U | I | O | P |
|quote |kill |end of|search|transp|yank |repeat|tab |open |up |
|prefix|block |line | back |chars |killed|counts| key |line |arrow |
+--------------------------------------------------------------------+
| A | S | D | F | G | K | L |
|left |search|delete|right |abort |kill |center| EMACS KEYS ARE
|edge |ahead |char |arrow |all |to end|window| EXECUTED BY HOLDING
+------------------------------------------------+ DOWN THE CTRL KEY
| Z | X | C | V | B | N | AND PRESSING THE
|line |Emacs |exit |page |left |down | INDICATED LETTER
|down |prefix|editor|ahead |arrow |arrow |
+-----------------------------------------+
CUSTOMIZING PI.
The changes that can be made to the operation of PI are made through
resource files which are read by the editor. Many of the changes can
be done interactively as well. The files are:
Description Example file name
--------------------------------------------------
Defaults resource file ~/.pirc PI.SET
Key mapping resource file ~/.mykeys.key mykeys.key
Custom terminal file ~/.termcap NA
UNIX DEFAULT SETUP FILE.
It is possible to customize PI for your own use, so that it wakes up
in the modes and options that you wish to use. The mechanism for this
customization is a special file called `.pirc', which is to reside in
the home directory. PI will read this file by default.
To build your own SPECIAL COPY of .pirc, copy the file `SYSpi.rc'
from the directory $PIE to $HOME and edit its contents. The system
default file appears below.
MSDOS DEFAULT SETUP FILE.
The advice for unix applies with file name $PIE/SYSpi.rc. The setup
file PI.SET is located in the same directory as PI.EXE. Also located
there is setup files PI.DAT, needed for the keymap editor.
Local setup is done from the connected direcotry by copying PI.SET
there. Under unix, copy $HOME/.pirc to the connected directory. If
unix $HOME/.pirc does not exist, then copy the system file to the
unix directory arrived at by login.
INITIAL STARTUP OPTIONS.
The editor can be invoked with file names on the command line, in
which case the first file is displayed on startup. If no files were
specified, then the options are (1) Start with UnTitled, (2) Start
with menu. These two actions are toggled by the setting in PI.SET (or
file ".pirc" under unix):
action.on.startup=1; Menu on initial startup
action.on.startup=0; Start with file name "UnTitled"
Hint: Specify a file on the command line to eliminate the creation of
the work file "UnTitled".
The novice startup displays a help message for the name of the
editor, an exit key and a menu key. Also displayed in the file in
which the message is enabled. Editing the following string in this
file [add it if not present] can enable/disable the novice message
[annoying startup message]. The file is root directory or connected
directory ".pirc" unless the system is MSDOS, in which case the file
name is PI.SET in the connected directory or the install directory.
annoying.startup.message=1; Annoyance enabled (1=default)
annoying.startup.message=0; Annoyance disabled
LOCAL SETUP.
The global setup file is "PI.SET" or ".pirc". A copy of it can
appear in a subdirectory to change defaults when PI is started from
that location. The items normally changed are backup, word wrap,
indent, margin, insert mode, colors, cursor.
UNIX TERMINAL TYPE.
The PI editor attempts to use system environment variables TERM and
TERMCAP to get terminal information. If these variables are unset,
then PI will assume vt100 and continue. For a list of all terminals
which are supported by PI, type the command $PIE/tcapnames.
Once the terminal type is known, you can either set the unix default
using the setterm command (see below), or else force PI to use the
terminal of your choice, via the command line switch "-term:" -- see
below.
The way to replace the system file /etc/termcap by your own is to use
features of environment variables which allow switching the system
default terminal database with another local one, over which you
have complete control. The basic mechanism the following:
setenv TERMCAP "tc=$HOME/.termcap"
where `.termcap' is a file in your home directory which contains the
termcap database record for your special terminal. Admittedly, this
is a fixup for missing entries in the termcap database, and you
should ask the system administrator to amend the database to
accommodate your equipment.
UNIX KEYBOARD.
The default keyboard function keys are set up by compiled defaults
that fit SUN and LINUX PC keyboards.
The editor has a keymap editor map function keys to ordinary tasks.
This is useful if you happen to have some extra function keys or if
the default maps are unsupported by the hardware.
IBM PC GREY KEYS.
Some of the keys on the IBM PC keyboard 101 are produced in
duplicate, notably the enter key and the arithmetic operators *+-/
which are near the numlock key.
The editor maps these keys to something useful when NUMLOCK is off.
When NUMLOCK is on the keypad becomes the classical "TEN KEY" for
data entry.
The defaults from compile time are (these settings may be put in
PI.SET):
plus.grey.keycode=33536; Grey plus mapped to "Alt =" (33536)
asterisk.grey.keycode=3103; Grey asterisk mapped to "Ctrl _" (3103)
enter.grey.keycode=33536; Grey enter mapped to "Alt =" (33536)
To restore all the keys to their original meaning use the following
lines in PI.SET:
plus.grey.keycode=20011; Grey plus mapped to itself (20011)
asterisk.grey.keycode=14122; Grey asterisk mapped to itself (14122)
enter.grey.keycode=57357; Grey enter mapped to itself (57357)
To decode the meaning of the keycodes requires translation from hex
numbers, usually printed in a reference manual for keys, into decimal
format. For the translations done above the codes work out as
follows:
Grey plus==0x4e2b==20011
Grey ast==0x372a==14122
Grey enter==0xe00d==57357
"Alt ="==0x8300==33536 (default is the ENTER key)
"Ctrl _"==0x0c1f==3103 (default is the MENU key)
A sample calculation (hex notation is a=10, b=11, c=12, d=13, e=14,
f=15):
0x4e2b == (4)16^3 + ( e)16^2 + ( 2)16^1 + ( b)16^0
== (4)16^3 + (14)16^2 + ( 2)16^1 + (11)16^0
== 20011
MOUSE.
Under unix the mouse setup is by X windows and not under the control
of PI (which uses X-term). All cut and paste operations are
controlled by X-term and the current X defaults for the window in
which PI is operating. The X-windows mouse is either on or off, as
set by the command line switch -m or the setup file toggle
"xmouse.toggle" (see .pirc).
MSDOS mouse control is by the mouse device driver supplied with the
mouse device. This software is installed during MSDOS boot before any
use of the mouse (the mouse won't work without it). If you are
running PI in a DOS window in Win95/98/2000, then Windows already has
assigned the mouse driver and nothing special is required, except to
allow that window to grab the mouse. Press the Win98 mouse on the "A"
icon to do that setup.
NOTE: These settings apply if PI was compiled with the mouse
routines. The default uses the TSR XPCMOUSE.EXE outside
PI or MS-Windows mouse.
In addition PI supplies two control variables in PI.SET. They are
horizontal.mouse.sens=8;
vertical.mouse.sens=16;
DEFAULTS. The defaults of 8 and 16 are recommended by most mouse
manufacturers. The effect of changing the numbers to a higher value
is to require more table space on which to move the mouse. Lower
numbers cause the mouse to react quickly to small motions on the
table.
DISABLE. Setting both values to 0 disables the mouse. It will not be
initialized or used. Use this setting if you are providing your own
mouse control program outside of PI, especially, MS-Windows.
MENU SLOWDOWN. The mouse action slows down on menus. It should be
approximately 8 times slower horizontally and twice as slow
vertically. The default is for the mouse to lock onto horizontal
lines. It will also lock onto columns but the bias is towards lines.
[With XPCMOUSE.EXE, menu access is by keyboard only. Ditto for
MS-Windows with the mouse properties disabled.]
CHANGES. In general the numbers 8 and 16 should be multiplied or
divided by powers of 2. You will find that changing 8,16 to 10,20
does no good at all: it just makes the mouse erratic.
BALLISTIC MOTION. Mouse driver software that provides ballistic
motion can be used to great advantage. Check out your mouse manual to
see if it is available and useful.
CURSOR STYLE.
The cursor under MSDOS can be set to a variety of styles. It is
easiest to set it experimentally from a pull-down menu inside the
editor. Then set it permanently in the setup file PI.SET. The
defaults of 1 and 13 apply to VGA. On some laptops and CGA machines
the defaults should be 6 and 7.
For unix under X-windows the cursor is set outside the editor by X
environment defaults. The basic customizations of the cursor in Xterm
are not very useful. The cursor color is settable by Xterm command
line arguments or in $HOME/.Xdefaults.
SETUP FILE .PIRC OR PI.SET.
; Default resource file "$HOME/.pirc" for the UNIX PI editor.
; Comment lines start with ';' or '#'.
; No leading white space on any line!
; The first three characters of a variable name are significant.
; Text can be edited.
;
; ====================== FAVORITE SETUP CHANGES =======================
;
select.emulation=2; None==0, Emacs==1, WordStar==2, WordPerfect==3. (2=default)
backup.toggle=2; Backup OFF (0) or ~/PIbackups (1) or ./PIbackups (2)
auto.indent.toggle=0; Toggle auto-indent word wrap (1=on,0=off). (1)
word.wrap.toggle=0; Toggle word wrap at right margin (1=on,0=off). (1)
hang.indent.toggle=0; Toggle hanging indent mode (1=on,0=off) (0)
xmouse.toggle=1; X-windows mouse for xterm. 0=off, 1=on.
; Press Left-mouse to set cursor, SHIFT-drag-mouse
; to copy and SHIFT-right-mouse to paste.
;
; ======================== STARTUP and EXIT =======================
;
annoying.startup.message=1; Annoyance enabled=1 (default), disabled=0
action.on.startup=1; Menu on initial startup (1) or UnTitled (0).
suspend.on.exit=1; Suspend PI on SAVE THEN EXIT ctrl-KX. MSDOS (1)
;
; ========================= SETUP SIZE LIMITS =========================
;
xms.maximum.blocks=1024; Block maximum msdos xms (512) or unix (1024)
block.buffer.size=16; Block size msdos [2k->10k] (4) or unix [2k->32k] (16)
string.reserve.blocks=6; Blocks reserved msdos for internal line copying (6)
max.macro.size=256; Size in chars of a macro recording buffer (256=normal).
available.macros=25; Number of macro slots. See MACNUM in v10.c (25=normal).
info.max.size=40; Number of files editor will load at one time (40)
killed.line.max=1000; Maximum killed lines that will be saved (100=normal).
line.max.chars=384; Maximum allowed line length (160=normal).
most.lines.count=40; Most lines per screen >= 1+(row-max-index) (40=normal).
;
;
bit.strip.toggle=0; Toggle stripping of 128-bit on input file (1=on,0=off).
detab.toggle=1; Toggle auto-detab of input during scrolling (1=on,0=off).
fold.case.toggle=1; Toggle case-insensitive search mode (1=on,0=off).
insert.toggle=1; Toggle insert mode (1=on,0=off).
status.line.toggle=1; Print status line during edit (2=all,1=no numbers,0=off).
screen.tab.stop=8; Screen tab stop increment for TAB key (8=normal).
file.detab.stop=8; Tab stop increment for detabbing a file (8=default).
import.type=3; Import text line delimiter code (1=MSDOS,2=MAC,3=UNIX).
export.type=3; Export text line delimiter code (1=MSDOS,2=MAC,3=UNIX).
drawing.style=1; Default line/box drawing style (1 to 5,1=default).
tab.insert.mode=0; Tab key inserts spaces and/or TAB (1=on,0=off)
return.insert.crlf=0; EMACS-like split on RETURN (1=on,0=off)
right.margin=72; Right margin for word wrap and centering (72=normal).
; Don't change these....
search.token.lf=-128; Token in search string used for begin or end line
cga.noretrace.video=1; Set noretrace mode for CGA video (1=mono/ega/vga).
;
; ====================== COLOR INFO for IBM-PC =======================
;
; dark colors: BLACK=0, BLUE=1, GREEN=2, CYAN=3, RED=4, MAGENTA=5,
; BROWN=6, LIGHTGRAY=7
; light colors: DARKGRAY=8, LIGHTBLUE=9, LIGHTGREEN=10, LIGHTCYAN=11,
; LIGHTRED=12, LIGHTMAGENTA=13, YELLOW=14, WHITE=15
; Example: foreground=BLACK, background=LIGHTCYAN uses attribute 48
; because (foreground+(background)*16) - 128 = 48.
; Warning: Attributes are in the range 0 to 127.
; Add 128 to an attribute to make it blink.
; MSDOS uses special codes:
;other.attributes=(7=mono,48=color)
;title.attribute=(31=boldface,15=mono).
;window.attribute=(19=blue /w yellow text,7=mono).
;border.attribute=(31=boldface,15=mono).
;
; Unix variables are completely different:
other.attributes=7; Screen attribute for edit screens (7=normal)
title.attribute=128; Window title attribute flag (128=boldface).
window.attribute=7; Window text attribute flag (7=normal text).
border.attribute=128; Window border attribute flag (112=reverse video).
box.characterset=0; Box border char set (0=Text,1=vga1,2=vga2,3=iso1,4=iso2)
;
; =============== UNIX Color info for ANSI terminals ==================
;
; Colors are 0-7: 0=black, 1=red, 2=green, 3=brown, 4=blue, 5=magenta,
; 6=cyan, 7=white.
; Foreground: 30-37, background 40-47.
ansi-mode-unix=1; Set ANSI terminal mode (unix only, 0=off, 1=on)
tfg-text-fg-color=30; Foreground text color 30-37 ANSI mode (0=default)
tbg-text-bg-color=46; Background text color 40-47 ANSI mode (0=default)
mfg-menu-fg-color=37; Foreground menu color 30-37 ANSI mode
mbg-menu-bg-color=44; Background menu color 40-47 ANSI mode
;
; ========================== Printer Setup ==========================
;
printer.number=0; set printer 0-6:prn,com1,com2,com3,lpt1,lpt2,lpt3
lpp.printer=55; lines printed per page, 55 normal (printer)
left.spaces.printer=0; number of spaces printed before line (printer)
top.lines.printer=5; number of blank lines at top (printer)
bot.lines.printer=5; number of blank lines at bottom (printer)
formfeed.printer=1; use formfeed between pages, 1=on,0=off (printer)
;
; The abort key interrupts macros and stops type-aheads (editor halt).
abort.editor.char=21; Bailout/abort key is normally ctrl-U (21 decimal)
;
; Next two handled by TERMCAP - changes declare you an expert! (Win3)
row.max.index=23; Rows numbered 0..ROWMAX (ROWMAX=23 is normal).
col.max.index=79; Columns numbered 0..COLMAX (COLMAX=79 is normal).
;
; ==================== MSDOS MOUSE and CURSOR ===================
;
; Normal settings MSDOS: 0,0,1,13
;
horizontal.mouse.sens=0; Mouse sensitivity. Normal=8, Mouse Off=0.
vertical.mouse.sens=0; Mouse sensitivity. Normal=16, Mouse Off=0.
chigh.cursor.shape=1; Set IBM cursor to vga (1) or cga (6) or mono (12).
clow.cursor.shape=13; Set IBM cursor to vga (13) or cga (7) or mono (13)
;
; ======================= HTML Browser Default ======================
;
; Win95/98/2000: Unix:
; browser=firefox.exe browser=firefox
; browser=iexplorer.exe browser=netscape& [launch in background]
; browser=lynx
browser=netscape&
;
; ======================= MSDOS Bios KEY REMAP ======================
;
; MSDOS: Mapping of GREY keys on IBM 101 keyboard via bios keycode
; Grey plus==0x4e2b==20011, Grey ast==0x372a==14122, Grey ent==0xe00d==57357
; "Alt ="==0x8300==33536 (ENTER key), "Ctrl _"==0x0c1f==3103 (MENU key)
; To restore a key, use its keycode, e.g., uncomment one of these:
plus.grey.keycode=20011; Grey plus mapped to itself (20011)
asterisk.grey.keycode=14122; Grey asterisk mapped to itself (14122)
;enter.grey.keycode=57357; Grey enter mapped to itself (57357)
; The defaults from compile time are:
;plus.grey.keycode=33536; Grey plus mapped to "Alt =" (33536)
;asterisk.grey.keycode=3103; Grey asterisk mapped to "Ctrl _" (3103)
;enter.grey.keycode=33536; Grey enter mapped to "Alt =" (33536)
;
; ====================== Cycle Tables for accented chars =============
;
;czech keys. The array is 66 chars long. First is space \40.
; The 33 pairs are toggled by the F12 key or ctrl-\.
; To see the set correctly load MSDOS 5.0 code page 852!
;31000
; foreign=\40\363a\240e\202i\241o\242u\243y\354c\237d\324n
; foreign=\345r\375s\347t\234z\247A\265E\220I\326O\340U\351Y
; foreign=\355C\254D\322N\325R\374S\346T\233Z\246\243\205\205u
; foreign=\202\330\330e\220\267\267E
;
; ============================ KEY MAPS ===========================
;
; The keymap changes from the default plus macro keys are to be entered
; below. Global changes should be made in the system file PI.SET using
; the editor built-in "Keymap Editor" on the TOOLS menu.
;
; A local change comes from copying PI.SET to the connected directory.
; PI.SET is read during PI startup. Dynamic local changes in the keymap
; can be made from PI-MACRO.KEY, which is also read on startup, from the
; connected directory. Startup macros and key definitions can be in
; both files. PI.SET is read first, then PI-MACRO.KEY. Permanent
; local changes are made by manually moving text from PI-MACRO.KEY
; into the file PI.SET. All changes made in the KEYMAP EDITOR go directly
; into PI.SET. The file PI-MACRO.KEY is considered a temp file, but it
; is useful for temporarily loading some macros.
;
; All remarks here apply as well to unix, where the file names change to
; ".\PI.SET" <--> "./.pirc" and ".\PI-MACRO.KEY" <--> "./pi-macro.key".
;
15001 * Latex * [MACROKEY+1]
macro=^K^S\E\Elatex ^K^F^O^R
key=\E1
tool=Latex on current file
15002 * View dvi * [MACROKEY+2]
macro=\E\Exdvi ^K^F^H^H^H^H &^O^R
key=\E2
tool=Xdvi on current file
15003 * Print dvi * [MACROKEY+3]
macro=\E\Elpr ^K^F^H^H^H.dvi^O^R
key=\E3
15004 * ispell * [MACROKEY+4]
macro=\E\Eispell ^K^F^O^R
key=\E4
15005 Date line [MACROKEY+5]
key=\Ed
macro=^Q^Pdate^M
tool=Date insert
15006 Xterm font "fixed" [MACROKEY+6]
macro=^O^Qecho -e "\033]50;fixed\7"^M
tool=Xterm setfont "fixed"
15007 Inject date [MACROKEY+7]
key=\Ed
macro=^Q^Pdate^M
tool=Inject date
; ========= End of original PI.SET source ======================