Unix keyboard mappings can be made at four levels.
DOT/LOGIN
files
DOT/LOGIN
files
TheBACKSPACEkey rather than theDELkey is set to perform "erase",
ie, to rubout the character before the cursor.
In each user's .login/.bash_login file there exists a tset line which does the reverse of the above. This is there for historical reasons (remember the Vaxen?). This must be undone. Each user should:
This will fix the lowest level mapping.
Executing the command:
stty -a
should report:
^H
(backspace)
set to
erase.
Type: echo $SHELL in order to determine which interactive shell you are running. The answer should be either bash or tcsh.
Interactive shells allow command line editing,
ie to move left or right along a line by characters or words
delete backwards or forwards characters or words.
Also to step back or forward through the list of
previously executed commands using the up and down cursor keys.
Key bindings at the interactive shell level need
to reinforce, or at least not override,
the basic level mapping of "Backspace" to perform erase.
Also, bindings are needed to define control keys for word movement
and deletion, with "Del" is set to perform delete forward.
[The function of the cursor keys is usually sorted out
internally without the need for explicit bindings
ie if you do not tamper with the cursor key bindings at any mapping level
they will work just fine!]
Tcsh:
Key bindings for
tcsh
are set in the system
DOT/LOGIN
file and should not
need any user definitions.
If any are made they should be in the form of
bindkey
commands in a user's
~/.login
file.
As none are required if any are present from times past
they should probably be removed!
Bash:
Key bindings for
bash
need to be set in a user's
~/.inputrc
file.
It is necessary to explicitly enforce that "Backspace" is designated for
erase and "Del" for delete forward.
The execution of the
fixtset
command (see above) will also automatically execute
fixinputrc
to ensure these mappings are correctly installed.
Any mappings that use the xmodmap command (usually in the file .xinitrc) should be removed, or at least commented out. xmodmap is a crude way to achieve what should have been set at the lowest level (section 1).
X-terminals, ie command windows in which interactive shells are run, so all the mappings described above are effective. A few extra bindings pertinent to an xterm environment can be made. For example, xterms have a vertical scroll bar so that you can look back up at previous output. For example, a Sun keyboard has two keys labelled "PgUp". These can be bound to ``page up'' the screen. By contrast, in a document viewing program, eg ghostview, they can be bound to view the previous page of a document.
The reference file for X application specific key bindings is:
/usr/local/DOT/.Xdefaults
This is the skeleton of which each user initially is given a copy.
Of course, the user's copy will evolve to suit their own needs
independently of the skeleton which will evolve as good
practice for the common good develops.
Thus, users are advised periodically to compare the current skeleton with their own
copy,
~/.Xdefaults
and add to it any additional entries that look promising!
[The easiest way to copy lines from the skeleton into your own file
is by cutting and pasting (qv).]
Users should have a paragraph headed
xterm.vt100.translations
which, at the time of writing contains
lines referring to
PRIMARY,CLIPBOARD
which pertain to cutting and pasting,
lines to referring to the keys "Home", "End", "Prior" and "Next"
which pertain to line editing (beginning or end) and scrolling.
To automatically replace the mappings in your
~/.Xdefaults
file by the standard set, use the local command:
fixmapxterm
If one holds down the LH mouse button and draws
the mouse over some text, this will be highlighted.
In generic X applications
when the mouse button released the highlighted text is drawn into the
PRIMARY
buffer.
If one moves to another generic X application,
the contents of the
PRIMARY
buffer is regurgitated when the centre button is pressed
as if the text had been typed in on the keyboard.
Thus, if one is in a text editor ensure the editor is in text insert mode
before pressing the regurgitation button in order for the text to
be inserted correctly.
Sun Generic Applications do not use the
PRIMARY
buffer but an alternative
buffer called the
CLIPBOARD.
Sun applications have a distinctive appearance,
and you just have to learn which applications belong to this stable.
To mark text to be copied, hold down the LH mouse button
and draw the mouse over the text (as above).
The text is not actually stored in the buffer until
the
Copy
key is pressed.
When the
Copy
key is pressed (alternatively, on non-Sun keyboards,
META+C)
the highlighted text is copied into the
CLIPBOARD
buffer.
The regurgitation of the
CLIPBOARD
buffer is achieved by pressing the
Paste,
or
META+P,
key(s).
The xterm key bindings described in the previous section
facilitate cutting and pasting between Sun and xterm applications
by allowing, in xterms, the
Copy
key to copy into both buffers
and conversely the
Paste
key to regurgitate from either buffer.
A little experimentation will enable the nuances to be learned.
All the above should work if you can identify the correct
META
key to use in conjunction with
C
and
P
keys.
Copying what is on the screen is exactly that, you are copying the visible portrayal of what was used to produce the text and NOT the original character stream that produced that image.
For example, if tabulated data separated using ``tabs'' is copied, what is actually copied will be the spaces the ``tabs'' expanded to at the time. Hence, programmers should never cut and paste between ``make'' files, the syntax of which demands tabs precede each method line.
Some characters are displayed as two printing characters, eg
CONTROL-G
is a single character but displayed as two
^G,
(or not displayed at all as ^G is the code to ring the bell).
When such text is copied, it is the two printed characters
that are copied, not the original control-G.
The file
/usr/local/DOT/.exrc
is the skeleton on which
all users should base their own copy,
~/.exrc.
The skeleton contains the necessary mappings to enable the cursor keys to
behave sensibly when in insert
(text entry) mode.
They actually terminate text entry (ESC) and then do the specified move.
Caution: The skeleton file contains raw control characters that
cannot be cut and pasted into a user's copy.
Instead, the content of the skeleton file must be read into
the user's file, either by using
cat,
ie:
cat /usr/local/DOT/.exrc >>~/.exrc
or by using
the file read command in
vi
itself:
vi ~/.exrc
:r /usr/local/DOT/.exrc