PC-like keyboard for console

From: Lars Eighner (eighner_at_io.com)
Date: 12/17/04


Date: Fri, 17 Dec 2004 07:37:21 -0600

For a more PC-like keyboard.

1) ALT-<keyboard character> does not produce the character
I expect.
2) My ALT key is working, but some applications want a
META key. What is that?
3) My ALT-<function keys> change virtual terminals instead
of doing what I think they should.
4) So far so good, but now my DELETE/BACKSPACE/DEL keys
don't work.
5) Whoa! I installed the emacs keyboard and now the NUM
LOCK affects my non-keypad arrow keys, etc.
6) Wow, there are a lot of key combinations that I could
map to other useful stuff!

This article assumes a user has a PC with a PC keyboard
attached, and the user desires that the keyboard act in a
somewhat more PC-like way in the FreeBSD console and
virtual terminals. Some, not so thoroughly tested,
suggestions are made towards obtaining similar behaviors
from Xterm and similar X applications which observe the
defaults for Xterm. Although the examples given here are
based on a US 104 or 105 keyboard and a US or Western
European character set, the principles discussed here
should work with most (or all) European keyboards and
character sets used with PCs. The wisdom of desiring a
more PC-like keyboard is not discussed here. This article
is aimed primarily at home computer users with FreeBSD
installed.

References: man keyboard, man keymap, man kbdmap, man
kbdcontrol.

The chief complaints treated here are:

1) ALT-<keyboard character> does not produce the character
I expect.
2) My ALT key is working, but some applications want a
META key. What is that?
3) My ALT-<function keys> change virtual terminals instead
of doing what I think they should.
4) So far so good, but now my DELETE/BACKSPACE/DEL keys
don't work.
5) Whoa! I installed the emacs keyboard and now the NUM
LOCK affects my non-keypad arrow keys, etc.
6) Wow, there are a lot of key combinations that I could
map to other useful stuff!

The How-tos First

Requirements:

FreeBSD, unlike some Linux and other BSD distributions
makes editing console (virtual terminal) keymaps very easy.

You need root privileges to edit keymaps and to make them
load on boot. And you need a flat text editor, like joe,
pico, or ee, or a word processor that can save as flat
text. Rectangular cut-and-paste (as in joe, emacs, etc.)
may be helpful if you know how to use it. It is most
helpful to work from the bash shell which will echo the
string sent by a key after CTRL-v (or another shell with a
similar behavior).

The console keymaps are found in /usr/share/syscons/keymaps
. It is highly recommend that you backup a keymap or
change its name before editing it. If you edit an existing
keymap, it will be restored every time you rebuild
(upgrade) your system, so you should save a copy of your
edited version in some other directory, such as /root/ .

The keymap you want to use is set in /etc/rc.conf with
a line like this:

keymap="us.emacs"

To be effective, this line must be the last of similar lines
in rc.conf. (Essentially, the defaults are in /etc/default -
don't mess with them - and sysinstall and you use /etc/rc.conf
to make changes, and the last change in this file wins.)

Changes made in rc.conf will not be effective until or
unless you reboot. You can use kbdcontrol with the -l
switch to change keymaps in your current session.

The keymaps which is loaded on boot can be set

1) ALT-<keyboard character> does not produce the character
I expect.

If you are a PC user, the character you expect is the
keyboard character with the eighth bit set.

You can test with bash, by entering CTRL-v followed by a
keystroke at the command line. CTRL-v 1 (don't enter a
space; the space just indicates you release CTRL-v before
pressing 1) should return 1 . And if ALT keys are working
CTRL-v ALT-1 should return \261 (261 is octal for 177, which
is 128 (decimal) more than 41 (decimal) which is the ascii
code for the character 1. In any event if CTRL-v ALT-1
returns 1, your problem may be easily solved by installing
the emacs keymap.

Here is a part of the keymap you probably installed
(probably us-iso):

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
   000 nop nop nop nop nop nop nop nop O
   001 esc esc esc esc esc esc debug esc O
   002 '1' '!' nop nop '1' '!' nop nop O
# ^^^
   003 '2' '@' nul nul '2' '@' nul nul O

See, ALT-1 simply sends 1, and ALT-! simply sends !, and that is
not what you want. (Help in reading a keymap is at man
keymap. Believe me, this a breeze compared with the
situation in some Linux and other BSD distributions.)

Here is the same part of the us-emacs keymap:

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
   000 nop nop nop nop nop nop nop nop O
   001 esc esc esc esc esc esc esc esc O
   002 '1' '!' nop nop 177 161 nop nop O
# ^^^
   003 '2' '@' nul nul 178 192 128 128 O

Now see, 1 sends 1 which is character code 49, but ALT-1 sends
177, which is 49 + 128 - or in other words 1 with the 8th bit
set. So if that is what you want (and it is probably what you
expect on a PC), just switch to the emacs keyboard).

If you know ALT-1 is sending 177 (or \261 octal) but that
still is not the character you expect, you probably do not
have the character set installed that you think you do.
Changing the character set is not within the scope of this
article. Maybe next time.

2) My ALT key is working, but some applications want a
META key. What is that?

A META key is a way of doing indirectly what an ALT key
does directly. The purpose of the META key was to send
eight-bit characters through essentially seven-bit lines.

The META key was used to send a string composed of the
ESCAPE character plus the keyboard character. (The
escape character is CTRL-[, which is what is sent by
the ESC key on the PC keyboard. Some applications which
want META key type inputs will accept <ESC> <keyboard
character> - that is, you can press and release <ESC>
and then press the keyboard character. Other approaches
are for applications to accept ALT-<keyboard character>
or to make a real META key on the keyboard. It is very
convenient with some applications to have a META key
so that you can use it like an ALT key, although it sends
something slightly different. If you have a keyboard with
a Windows key, you can make this into a META key, or if not
you can make one of the ALT keys into a META key.

To edit your keyboard to make the Windows keys into a META
key, simply edit or add lines for keys 105 and 106 with
meta in the base position. Here key 107, the menu key, has
been mapped to ESC, for those of you too lazy to reach all
the way up when you want the ESC key:

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
# <many lines omitted here>
   105 meta fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O
   106 meta fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O
   107 esc fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O

If you don't have Windows keys get a new keyboard - they are
cheap - or remap one or the other of the ALT keys. I think
it is more usual to remap the right alt key to meta, but
pick whichever one you want, and substitute meta for ralt
or lalt in the first position.

Original:

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
# <many lines omitted here>
   056 lalt lalt lalt lalt lalt lalt lalt lalt O
# <many lines omitted here>
   093 ralt ralt ralt ralt ralt ralt ralt ralt O

ralt changed to meta:

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
# <many lines omitted here>
   056 lalt lalt lalt lalt lalt lalt lalt lalt O
# <many lines omitted here>
   093 meta ralt ralt ralt ralt ralt ralt ralt O

3) My ALT-<function keys> change virtual terminals instead
of doing what I think they should.

Finally we come to the function keys known as F1, F2, ... F12.
Again I am assuming an ordinary PC with a more or less PC
compatible keyboard attached.

Here's the pertinent part of the us.emacs keyboard (with a
bunch of stuff skipped so you can easily see the headers -
which are actually comment lines for human beings and do
affect the keymap in any way).

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
   000 nop nop nop nop nop nop nop nop O
# skipped stuff
   059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O
   060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O
   061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O
   062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O
   063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O
   064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O
   065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O
   066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O
   067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O
   068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O
# stuff skipped between f10 and f11
   087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
   088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O

What this does is make ALT-Fx switch to virtual terminal x.
Probably you want ALT-Fx to send the ANSI codes <ESC>-[-w
through <ESC>-[-{. These codes are sent by fkey37 through
fkey48.

All you have to do is switch fkey37 with scr01, fkey38 with
scr02, etc.

Like this:
# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
#Stuff skipped
   059 fkey01 fkey13 fkey25 scr01 fkey37 scr11 scr01 scr11 O
   060 fkey02 fkey14 fkey26 scr02 fkey38 scr12 scr02 scr12 O
   061 fkey03 fkey15 fkey27 scr03 fkey39 scr13 scr03 scr13 O
   062 fkey04 fkey16 fkey28 scr04 fkey40 scr14 scr04 scr14 O
   063 fkey05 fkey17 fkey29 scr05 fkey41 scr15 scr05 scr15 O
   064 fkey06 fkey18 fkey30 scr06 fkey42 scr16 scr06 scr16 O
   065 fkey07 fkey19 fkey31 scr07 fkey43 scr07 scr07 scr07 O
   066 fkey08 fkey20 fkey32 scr08 fkey44 scr08 scr08 scr08 O
   067 fkey09 fkey21 fkey33 scr09 fkey45 scr09 scr09 scr09 O
   068 fkey10 fkey22 fkey34 scr10 fkey46 scr10 scr10 scr10 O
#stuff skipped
   087 fkey11 fkey23 fkey35 scr11 fkey47 scr11 scr11 scr11 O
   088 fkey12 fkey24 fkey36 scr12 fkey48 scr12 scr12 scr12 O

And that's that. CTRL-SHIFT-<function key> will now change
virtual terminals, and ALT-<function key> will now send the
ANSI codes you expect.

Bonus: Make ALT-tab and CTRL-tab rotate through the virtual
screens:

   015 ht ht nscr ht pscr 137 137 137 O

4) So far so good, but now my DELETE/BACKSPACE/DEL keys
don't work.

If you are not use the emacs keyboard probably they do
work, but Unix-like applications (including shells) have
some funny ideas of what to do with deletes and backspaces.
For the most part you have to fix this on an application by
application basis. Emacs, for example, effectively
disabled BACKSPACE by using CTRL-H (which is the same as
the PC BACKSPACE) for its help function. If a fix for this
is not incorporated in your emacs distribution, it is
easily found in the appropriate emacs FAQ because this is a
common complaint.

If your are using the emacs keyboard you may have to
remap a couple of keys to put the deletes where you expect
them to be, but as mentioned above, many applications will
not do what you expect when they do get a delete.
(I had a vague recollection that the ANSI sequence
for the non-keypad delete should be <ESC>-[-E. I
cannot confirm this at all as I recheck things for
this article. That sequence is fkey54 in FreeBSD
keymaps and is associated with the "nameless key"
 - which is the keypad 5, without NUM LOCK).

The Unix DELETE is CTRL-? (also represented by ^?).
This is represented in FreeBSD keymaps with del
or fkey61.

The non-keypad DELETE is key 103. In the emacs keymap this
is fkey54 (<ESC>-[-E). The keypad delete is key 083 and
you can map it to del (^?). You might want to leave the
non-keypad DELETE the way it is because in some cases in
which you cannot convince applications to do the right
thing with ^?, you might be able to write a macro that will
do what you want a DELETE to do which you then could assign
to <ESC>-[-E. (But see the following section.)

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
  083 del '.' '.' '.' 174 174 174 174 N
  103 fkey54 '5' '5' '5' 181 181 181 181 N

Depending upon which keymap you start with, when you start
editing, you may notice boot entered for the combination
alt-cntrl for one or both of the delete keys. If you want
the traditional three-fingered salute (alt-control-delete)
to reboot the system (as a last resort), you can enter boot
in the keymap.

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
  083 del '.' '.' '.' 174 174 boot 174 N
  103 fkey54 '5' '5' '5' 181 181 boot 181 N

You shouldn't reboot this way if you can help it, and if
you can't help it, it may not work anyway. But there is a
good chance it will bring the system down cleanly when you
are otherwise trapped (a much rarer occurrence than with
some other PC operating systems, but one that can happen).

Removing boot from the keymap (by replacing it with
something like nop) is not a security measure - except
possibly against clumsiness, cats and children. However,
for the home PC user, presumably anyone who could hit
CTRL-ALT-DEL could just as well pull the plug or turn off
the main power (with possibly worse results), so further
efforts to secure the keyboard would be pointless.

5) Whoa! I installed the emacs keyboard and now the NUM
LOCK affects my non-keypad arrow keys, etc.

Yes, the emacs keyboard maps the the non-keypad functions
keys exactly like the keypad keys. You may want to import
the mappings for keys 094 - 103 from the us.iso.kbd to
cut your non-keypad arrow keys, Home, etc. away from
numbers altogether.

# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
# ------------------------------------------------------------------
  094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O
  095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O
  096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O
  097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O
  098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O
  099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O
  100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O
  101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O
  102 fkey60 paste fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O
  103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O

Note: so far as I can tell fkey61 is presently just the
same as del and both send ^?. You may or may not want to
remap key 103 in light of the discussion in the previous
section.

6) Wow, there are a lot of key combinations that I could
map to other useful stuff!

Yes, there are. However, the alt-cntrl keys are sometimes
used by X, and you might want to reserve these. The
possible mappings for keys are listed in man keymap.

7) Can I make Xterm work more like the console and virtual
terminals so I can run the console applications, which I
have tamed in the console, on X?

Yes, more or less. However, Xterm and several of its near
clones use the same the configuration files, so if you
configure it for this purpose it may make Xterm and its
near relatives useless for connecting to remote systems
when you really need VT100 emulation.

Assuming you have decided to use the Window keys for
META and are having both ALT and META keys and want
to retain the <ESC>-[-E for the nonkey pad:

Use xkeycaps to be sure you have correctly identified
in X the keys which you know as Windows. WARNING: X does
not number keys in the same way that console keymaps do.

Use xmodmap to load the mapping of these keys to META
which may look something like this if you load from
a file:

keycode 115 = Meta_L
keycode 116 = Meta_R

Exactly how you use xmodmap will depend upon your
windows manager.

Add this to your .Xdefaults file:

!! xterm keymappings
*XTerm*VT100.translations: #override \n\
         None<Key>F1: string(0x1b) string("[M") \n\
         None<Key>F2: string(0x1b) string("[N") \n\
         None<Key>F3: string(0x1b) string("[O") \n\
         None<Key>F4: string(0x1b) string("[P") \n\
         None<Key>F5: string(0x1b) string("[Q") \n\
         None<Key>F6: string(0x1b) string("[R") \n\
         None<Key>F7: string(0x1b) string("[S") \n\
         None<Key>F8: string(0x1b) string("[T") \n\
         None<Key>F9: string(0x1b) string("[U") \n\
         None<Key>F10: string(0x1b) string("[V") \n\
         None<Key>F11: string(0x1b) string("[W") \n\
         None<Key>F12: string(0x1b) string("[X") \n\
         None<Key>Insert: string(0x1b) string("[L") \n\
         Shift<Key>F1: string(0x1b) string("[Y") \n\
         Shift<Key>F2: string(0x1b) string("[Z") \n\
         Shift<Key>F3: string(0x1b) string("[a") \n\
         Shift<Key>F4: string(0x1b) string("[b") \n\
         Shift<Key>F5: string(0x1b) string("[c") \n\
         Shift<Key>F6: string(0x1b) string("[d") \n\
         Shift<Key>F7: string(0x1b) string("[e") \n\
         Shift<Key>F8: string(0x1b) string("[f") \n\
         Shift<Key>F9: string(0x1b) string("[g") \n\
         Shift<Key>F10: string(0x1b) string("[h") \n\
         Shift<Key>F11: string(0x1b) string("[i") \n\
         Shift<Key>F12: string(0x1b) string("[j") \n\
         Ctrl<Key>F1: string(0x1b) string("[k") \n\
         Ctrl<Key>F2: string(0x1b) string("[l") \n\
         Ctrl<Key>F3: string(0x1b) string("[m") \n\
         Ctrl<Key>F4: string(0x1b) string("[n") \n\
         Ctrl<Key>F5: string(0x1b) string("[o") \n\
         Ctrl<Key>F6: string(0x1b) string("[p") \n\
         Ctrl<Key>F7: string(0x1b) string("[q") \n\
         Ctrl<Key>F8: string(0x1b) string("[r") \n\
         Ctrl<Key>F9: string(0x1b) string("[s") \n\
         Ctrl<Key>F10: string(0x1b) string("[t") \n\
         Ctrl<Key>F11: string(0x1b) string("[u") \n\
         Ctrl<Key>F12: string(0x1b) string("[v") \n\
         Alt<Key>F1: string(0x1b) string("[w") \n\
         Alt<Key>F2: string(0x1b) string("[x") \n\
         Alt<Key>F3: string(0x1b) string("[y") \n\
         Alt<Key>F4: string(0x1b) string("[z") \n\
         Alt<Key>F5: string(0x1b) string("[@") \n\
         Alt<Key>F6: string(0x1b) string("[[") \n\
         Alt<Key>F7: string(0x1b) string("[ ") \n\
         Alt<Key>F8: string(0x1b) string("[]") \n\
         Alt<Key>F9: string(0x1b) string("[^") \n\
         Alt<Key>F10: string(0x1b) string("[_") \n\
         Alt<Key>F11: string(0x1b) string("[`") \n\
         Alt<Key>F12: string(0x1b) string("[{") \n\
         Meta<Key>a: string(0x1b) string("a") \n\
         Meta<Key>b: string(0x1b) string("b") \n\
         Meta<Key>c: string(0x1b) string("c") \n\
         Meta<Key>d: string(0x1b) string("d") \n\
         Meta<Key>e: string(0x1b) string("e") \n\
         Meta<Key>f: string(0x1b) string("f") \n\
         Meta<Key>g: string(0x1b) string("g") \n\
         Meta<Key>h: string(0x1b) string("h") \n\
         Meta<Key>i: string(0x1b) string("i") \n\
         Meta<Key>j: string(0x1b) string("j") \n\
         Meta<Key>k: string(0x1b) string("k") \n\
         Meta<Key>l: string(0x1b) string("l") \n\
         Meta<Key>m: string(0x1b) string("m") \n\
         Meta<Key>n: string(0x1b) string("n") \n\
         Meta<Key>o: string(0x1b) string("o") \n\
         Meta<Key>p: string(0x1b) string("p") \n\
         Meta<Key>q: string(0x1b) string("q") \n\
         Meta<Key>r: string(0x1b) string("r") \n\
         Meta<Key>s: string(0x1b) string("s") \n\
         Meta<Key>t: string(0x1b) string("t") \n\
         Meta<Key>u: string(0x1b) string("u") \n\
         Meta<Key>v: string(0x1b) string("v") \n\
         Meta<Key>w: string(0x1b) string("w") \n\
         Meta<Key>x: string(0x1b) string("x") \n\
         Meta<Key>y: string(0x1b) string("y") \n\
         Meta<Key>z: string(0x1b) string("z") \n\
         Meta<Key>1: string(0x1b) string("1") \n\
         Meta<Key>2: string(0x1b) string("2") \n\
         Meta<Key>3: string(0x1b) string("3") \n\
         Meta<Key>4: string(0x1b) string("4") \n\
         Meta<Key>5: string(0x1b) string("5") \n\
         Meta<Key>6: string(0x1b) string("6") \n\
         Meta<Key>7: string(0x1b) string("7") \n\
         Meta<Key>8: string(0x1b) string("8") \n\
         Meta<Key>9: string(0x1b) string("9") \n\
         Meta<Key>0: string(0x1b) string("0") \n\
         Meta<Key>Escape: string(0x1b) string(0x1b) \n\
         Meta<Key>exclam: string(0x1b) string("!") \n\
         Meta<Key>at: string(0x1b) string("@") \n\
         Meta<Key>numbersign: string(0x1b) string("#") \n\
         Meta<Key>dollar: string(0x1b) string("$") \n\
         Meta<Key>percent: string(0x1b) string("%") \n\
         Meta<Key>asciicircum: string(0x1b) string("^") \n\
         Meta<Key>ampersand: string(0x1b) string("&") \n\
         Meta<Key>asterisk: string(0x1b) string("*") \n\
         Meta<Key>parenleft: string(0x1b) string("(") \n\
         Meta<Key>parenright: string(0x1b) string(")") \n\
         Meta<Key>minus: string(0x1b) string("-") \n\
         Meta<Key>underscore: string(0x1b) string("_") \n\
         Meta<Key>equal: string(0x1b) string("=") \n\
         Meta<Key>plus: string(0x1b) string("+") \n\
         Meta<Key>bracketleft: string(0x1b) string("[") \n\
         Meta<Key>braceleft: string(0x1b) string("{") \n\
         Meta<Key>bracketright: string(0x1b) string("]") \n\
         Meta<Key>braceright: string(0x1b) string("}") \n\
         Meta<Key>semicolon: string(0x1b) string(";") \n\
         Meta<Key>colon: string(0x1b) string(";") \n\
         Meta<Key>apostrophe: string(0x1b) string("0x27") \n\
         Meta<Key>quotedbl: string(0x1b) string("0x22") \n\
         Meta<Key>grave: string(0x1b) string("9x96") \n\
         Meta<Key>asciitilde: string(0x1b) string("~") \n\
         Meta<Key>backslash: string(0x1b) string("0x92") \n\
         Meta<Key>bar: string(0x1b) string("|") \n\
         Meta<Key>comma: string(0x1b) string(",") \n\
         Meta<Key>less: string(0x1b) string("<") \n\
         Meta<Key>period: string(0x1b) string(".") \n\
         Meta<Key>greater: string(0x1b) string(">") \n\
         Meta<Key>slash: string(0x1b) string("/") \n\
         Meta<Key>question: string(0x1b) string("?") \n\
         <Key>Delete: string(0x1b) string("[E") \n\
         <Key>KP_Delete: string(0x7f) \n\

be sure there is newline character immediately following
the final \ on each line, otherwise enter these lines
verbatim (i.e. enter \ for \ and n for n in \n\, not
newline\.

This is not extremely well tested as I hardly ever use X
when I can use a console application.

This document:

This is version 1.0. Corrections and additions should be
sent to eighner@io.com.

For the future: Accounts of how to produce PC-style delete
behavior in each of the various applications where that can
be achieved. A brief history of terminal input devices and
the reasons for the differences, when there are reasons. A
related document on console character sets and fonts.

-- 
Lars Eighner                   SAVE BEASTIE!           finger:R.I.P. at io.com
eighner@io.com                                     http://www.io.com/~eighner/
  TIP: In bash to see the string a key is sending to the shell, use Ctrl-v.
                     At the prompt enter: Ctrl-v <key>.


Relevant Pages

  • Re: How can I print 11 squared in a report ?
    ... I am in Belgium and using a microsoft QWERTY UK keyboard so probably ... but you can get a superscripted 2 by holding down the Alt key and ... squared) with the 2 printed as a superscript. ... Open the Character Map program. ...
    (microsoft.public.access.reports)
  • Re: pressed 2 keys
    ... By installing your own keyboard handler interrupt. ... generates it or an ALT combination above 127 ... character value. ...
    (comp.lang.asm.x86)
  • Re: Third level shift characters do not work (Belgian azerty)
    ... (mapped to "Alt Gr" on my keyboard) ... # code base shift cntrl shift alt shift cntrl shift state ... affect the keyboard in X - not even login terminals which may ... X is not really a part of the BSD system. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Hunters New Kitchen
    ... >> I have an ~ on my keyboard, but don't know how to get it to print on>> top of the n. ... Or you can hold down the <ALT> key and type the numerals 0241 using the keypad. ... This works for any other strange characters also - the key combination is in the bottom right corner of the character map window. ...
    (rec.outdoors.rv-travel)
  • Re: Can I find and replace with a hard return?
    ... The ý character is 0253 ... what: ALT + 0253 ... use the numpad on right-side of keyboard to enter the 0253 and 0010. ...
    (microsoft.public.excel.misc)