hypermap.m4 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. #
  2. # hypermap.map 1994/11/11
  3. # Michael Shields <shields@tembel.org>
  4. #
  5. # A keymap redesigned for sanity.
  6. #
  7. #
  8. # This keymap is a ground-up reimplementation of the keyboard map,
  9. # intended to be consistent and rational. It uses an m4 metalanguage to
  10. # declare the key mappings. Usage is `m4 hypermap.map | loadkeys'.
  11. #
  12. # The modifier flags used are `shift' (1), `control' (4), and `alt' (8).
  13. # Left and right modifiers are not distinguished.
  14. #
  15. # In general, Meta is always distinguished, and M-S-KEY is distinct from
  16. # M-KEY. This is good news for Emacs users. C-S-KEY is consistently
  17. # folded into C-KEY.
  18. #
  19. # Shift is more loosely interpreted than the other modifiers; usually if
  20. # S-KEY has no special meaning, the action will be the same as KEY.
  21. # However, if M-KEY or H-KEY is undefined, nothing happens.
  22. #
  23. # Because Caps Lock's position is so out of proportion to its utility,
  24. # it's been totally redefined to a new sort of modifier, which I've
  25. # arbitrarily named `Hyper'. Shift is ignored with Hyper. Hyper
  26. # provides dead keys:
  27. # H-` dead accent grave
  28. # H-' dead acute accent
  29. # H-^ dead circumflex
  30. # H-t dead tilde
  31. # H-d dead diaeresis
  32. # and ISO-8859-1 symbols (some more mnemonic than others):
  33. # H-SPC nobreakspace
  34. # H-! inverted bang
  35. # H-h cents (`hundredths')
  36. # H-# pounds sterling
  37. # H-$ currency
  38. # H-y yen
  39. # H-| broken bar
  40. # H-s section (the galaxy symbol)
  41. # H-c copyright
  42. # H-a feminine ordinal
  43. # H-< left guillemot
  44. # H-] not sign (it's angular)
  45. # H-- soft hyphen
  46. # H-r registered trademark symbol
  47. # H-= macron
  48. # H-0 degrees
  49. # H-[ plus/minus (near + and -)
  50. # H-k superior 2 (jkl form a series)
  51. # H-l superior 3
  52. # H-u mu
  53. # H-p pilcrow
  54. # H-: centered dot
  55. # H-j superior 1
  56. # H-o masculine ordinal
  57. # H-> right guillemot
  58. # H-q 1/4 fraction (qwe form a series)
  59. # H-w 1/2 fraction
  60. # H-e 3/4 fraction
  61. # H-? inverted question mark
  62. # H-x multiplication symbol
  63. # H-% division symbol
  64. # You can also use Hyper plus Alt to type characters by decimal code on
  65. # the keypad, as with Alt alone, or in hex on the main keyboard. And
  66. # H-TAB is a Caps Lock.
  67. #
  68. # Function keys work as marked, unless with Alt, in which case they
  69. # switch to the console with the same number. Shift adds 12 and Hyper
  70. # adds 24 to the numbers (i.e., they logically switch to other banks).
  71. # Thus you can easily address up to 48. Control is ignored, for
  72. # consistency with X.
  73. #
  74. # Finally, you can change the behavior of the Caps Lock and Controls
  75. # with m4 command-line options. The default values are equivalent to
  76. # `-DCAPSLOCK_K=Hyper -DLEFTCTRL_K=Control -DRIGHTCTRL_K=Control'. You
  77. # can remove the Hyper code entirely with `-DCAPSLOCK_K=Caps_Lock'.
  78. #
  79. # This file is arranged vaguely by key position on the classic PC layout.
  80. #
  81. dnl Set default values.
  82. ifdef(`CAPSLOCK_K', , `define(`CAPSLOCK_K', `Hyper')')
  83. ifdef(`LEFTCTRL_K', , `define(`LEFTCTRL_K', `Control')')
  84. ifdef(`RIGHTCTRL_K', , `define(`RIGHTCTRL_K', `Control')')
  85. dnl Figure out if any key is a Hyper key. If so, define `hyper', both
  86. dnl for usefulness and `ifdef' testability.
  87. ifelse(CAPSLOCK_K, `Hyper', `define(`hyper', `ctrlr')',
  88. LEFTCTRL_K, `Hyper', `define(`hyper', `ctrlr')',
  89. RIGHTCTRL_K, `Hyper', `define(`hyper', `ctrlr')')
  90. define(`Hyper', `CtrlR')
  91. keymaps 0,1,4,5,8,9,12,13`'ifdef(`hyper', `,128,129,132,133,136,137,140,141')
  92. dnl General usage of these macros is MACRO(KEYCODE, UNSHIFTED, SHIFTED).
  93. dnl We first undefine `shift', which only causes problems.
  94. undefine(`shift')
  95. define(`SIMPLE', `keycode $1 = $2 $2')
  96. define(`KEY',
  97. ` keycode $1 = $2 VoidSymbol
  98. shift keycode $1 = $3
  99. alt keycode $1 = Meta_$2
  100. shift alt keycode $1 = Meta_$3')
  101. dnl This macro adds Control variations to a key.
  102. define(`CONTROL',
  103. ` control keycode $1 = $2
  104. shift control keycode $1 = $2
  105. control alt keycode $1 = Meta_$2
  106. shift control alt keycode $1 = Meta_$2')
  107. dnl Add Hyper variations to a key.
  108. define(`HYPER', ifdef(`hyper',
  109. ` hyper keycode $1 = $2
  110. shift hyper keycode $1 = $2'))
  111. define(`CONTROLHYPER', ifdef(`hyper',
  112. ` control hyper keycode $1 = $2
  113. shift control hyper keycode $1 = $2'))
  114. define(`METAHYPER', ifdef(`hyper',
  115. ` alt hyper keycode $1 = $2
  116. shift alt hyper keycode $1 = $2'))
  117. define(`CONTROLMETAHYPER', ifdef(`hyper', dnl Ludicrous.
  118. ` control alt hyper keycode $1 = $2
  119. shift control alt hyper keycode $1 = $2'))
  120. dnl Special case for letters. Best to be explicit.
  121. define(`LETTER',
  122. ` keycode $1 = `+'$2 VoidSymbol
  123. shift keycode $1 = `+'translit($2, `a-z', `A-Z')
  124. alt keycode $1 = `Meta_'$2
  125. shift alt keycode $1 = `Meta_'translit($2, `a-z', `A-Z')
  126. CONTROL($1, Control_$2)')
  127. dnl For function keys. Call here is FUNCTION(KEYCODE, FKEYNUM).
  128. define(`BANKSIZE', 12)
  129. define(`FUNCTION',
  130. ` keycode $1 = `F'$2 VoidSymbol
  131. shift keycode $1 = `F'eval($2 + BANKSIZE)
  132. hyper keycode $1 = `F'eval($2 + BANKSIZE * 2)
  133. shift hyper keycode $1 = `F'eval($2 + BANKSIZE * 3)
  134. alt keycode $1 = `Console_'$2
  135. shift alt keycode $1 = `Console_'eval($2 + BANKSIZE)
  136. hyper alt keycode $1 = `Console_'eval($2 + BANKSIZE * 2)
  137. shift hyper alt keycode $1 = `Console_'eval($2 + BANKSIZE * 3)')
  138. dnl For the keypad digits. KPDIGIT(KEYCODE, DIGIT).
  139. define(`KPDIGIT',
  140. ` keycode $1 = KP_$2 VoidSymbol
  141. shift keycode $1 = KP_$2
  142. alt keycode $1 = Ascii_$2
  143. shift alt keycode $1 = Ascii_$2
  144. METAHYPER($1, Ascii_$2)')
  145. dnl And a special approximation:
  146. define(`Meta_Return', `Meta_Control_m')
  147. KEY(1, Escape, Escape)
  148. FUNCTION(59, 1)
  149. FUNCTION(60, 2)
  150. FUNCTION(61, 3)
  151. FUNCTION(62, 4)
  152. FUNCTION(63, 5)
  153. FUNCTION(64, 6)
  154. FUNCTION(65, 7)
  155. FUNCTION(66, 8)
  156. FUNCTION(67, 9)
  157. FUNCTION(68, 10)
  158. FUNCTION(87, 11)
  159. FUNCTION(88, 12)
  160. KEY(2, one, exclam)
  161. HYPER(2, exclamdown)
  162. METAHYPER(2, Hex_1)
  163. KEY(3, two, at)
  164. CONTROL(3, nul)
  165. METAHYPER(3, Hex_2)
  166. KEY(4, three, numbersign)
  167. HYPER(4, pound)
  168. METAHYPER(4, Hex_3)
  169. KEY(5, four, dollar)
  170. HYPER(5, currency)
  171. METAHYPER(5, Hex_4)
  172. KEY(6, five, percent)
  173. HYPER(6, division)
  174. METAHYPER(6, Hex_5)
  175. KEY(7, six, asciicircum)
  176. CONTROL(7, Control_asciicircum)
  177. HYPER(7, dead_circumflex)
  178. METAHYPER(7, Hex_6)
  179. KEY(8, seven, ampersand)
  180. METAHYPER(8, Hex_7)
  181. KEY(9, eight, asterisk)
  182. METAHYPER(9, Hex_8)
  183. KEY(10, nine, parenleft)
  184. METAHYPER(10, Hex_9)
  185. KEY(11, zero, parenright)
  186. HYPER(11, degree)
  187. METAHYPER(11, Hex_0)
  188. KEY(12, minus, underscore)
  189. CONTROL(12, Control_underscore)
  190. HYPER(12, hyphen)
  191. KEY(13, equal, plus)
  192. HYPER(13, macron)
  193. KEY(14, Delete, Delete)
  194. CONTROL(14, BackSpace)
  195. KEY(15, Tab, Tab)
  196. HYPER(15, Caps_Lock)
  197. LETTER(16, q)
  198. HYPER(16, onequarter)
  199. LETTER(17, w)
  200. HYPER(17, onehalf)
  201. LETTER(18, e)
  202. HYPER(18, threequarters)
  203. METAHYPER(18, Hex_E)
  204. LETTER(19, r)
  205. HYPER(19, registered)
  206. LETTER(20, t)
  207. HYPER(20, dead_tilde)
  208. LETTER(21, y)
  209. HYPER(21, yen)
  210. LETTER(22, u)
  211. HYPER(22, mu)
  212. LETTER(23, i)
  213. LETTER(24, o)
  214. HYPER(24, masculine)
  215. LETTER(25, p)
  216. HYPER(25, 182) # pilcrow
  217. KEY(26, bracketleft, braceleft)
  218. CONTROL(26, Escape)
  219. HYPER(26, plusminus)
  220. KEY(27, bracketright, braceright)
  221. CONTROL(27, Control_bracketright)
  222. HYPER(27, notsign)
  223. KEY(28, Return, Return)
  224. LETTER(30, a)
  225. HYPER(30, ordfeminine)
  226. METAHYPER(30, Hex_A)
  227. LETTER(31, s)
  228. HYPER(31, section)
  229. LETTER(32, d)
  230. HYPER(32, dead_diaeresis)
  231. METAHYPER(32, Hex_D)
  232. LETTER(33, f)
  233. METAHYPER(33, Hex_F)
  234. LETTER(34, g)
  235. LETTER(35, h)
  236. HYPER(35, cent)
  237. LETTER(36, j)
  238. HYPER(36, onesuperior)
  239. LETTER(37, k)
  240. HYPER(37, twosuperior)
  241. LETTER(38, l)
  242. HYPER(38, threesuperior)
  243. KEY(39, semicolon, colon)
  244. HYPER(39, periodcentered)
  245. KEY(40, apostrophe, quotedbl)
  246. HYPER(40, dead_acute)
  247. KEY(41, grave, asciitilde)
  248. HYPER(41, dead_grave)
  249. KEY(43, backslash, bar)
  250. CONTROL(43, Control_backslash)
  251. HYPER(43, brokenbar)
  252. LETTER(44, z)
  253. LETTER(45, x)
  254. HYPER(45, multiplication)
  255. LETTER(46, c)
  256. HYPER(46, copyright)
  257. METAHYPER(46, Hex_C)
  258. LETTER(47, v)
  259. LETTER(48, b)
  260. METAHYPER(48, Hex_B)
  261. LETTER(49, n)
  262. LETTER(50, m)
  263. KEY(51, comma, less)
  264. HYPER(51, guillemotleft)
  265. KEY(52, period, greater)
  266. HYPER(52, guillemotright)
  267. KEY(53, slash, question)
  268. HYPER(53, questiondown)
  269. KEY(57, space, space)
  270. CONTROL(57, nul)
  271. HYPER(57, nobreakspace)
  272. KPDIGIT(71, 7)
  273. KPDIGIT(72, 8)
  274. KPDIGIT(73, 9)
  275. SIMPLE(74, KP_Subtract)
  276. KPDIGIT(75, 4)
  277. KPDIGIT(76, 5)
  278. KPDIGIT(77, 6)
  279. SIMPLE(78, KP_Add)
  280. KPDIGIT(79, 1)
  281. KPDIGIT(80, 2)
  282. KPDIGIT(81, 3)
  283. KPDIGIT(82, 0)
  284. SIMPLE(83, KP_Period)
  285. SIMPLE(96, KP_Enter)
  286. SIMPLE(98, KP_Divide)
  287. SIMPLE(55, KP_Multiply)
  288. SIMPLE(118, KP_MinPlus)
  289. # Modifiers.
  290. keycode 42 = Shift
  291. keycode 54 = Shift
  292. keycode 56 = Alt
  293. keycode 100 = Alt
  294. keycode 58 = CAPSLOCK_K
  295. keycode 29 = LEFTCTRL_K
  296. keycode 97 = RIGHTCTRL_K
  297. # Everyone needs a compose key. This is C-..
  298. control keycode 52 = Compose
  299. SIMPLE(69, Num_Lock)
  300. keycode 70 = Scroll_Lock
  301. shift keycode 70 = Show_Memory
  302. control keycode 70 = Show_State
  303. alt keycode 70 = Show_Registers
  304. # SysRq. I suppose there's some reason it's ^\.
  305. SIMPLE(99, Control_backslash)
  306. SIMPLE(119, Pause)
  307. # Ctrl-Break seems to have low-level hardware behind it.
  308. SIMPLE(101, Break)
  309. SIMPLE(110, Insert)
  310. SIMPLE(102, Find)
  311. keycode 104 = Prior Scroll_Backward
  312. SIMPLE(111, Remove)
  313. SIMPLE(107, Select)
  314. keycode 109 = Next Scroll_Forward
  315. SIMPLE(103, Up)
  316. SIMPLE(105, Left)
  317. alt keycode 105 = Decr_Console
  318. SIMPLE(106, Right)
  319. alt keycode 106 = Incr_Console
  320. SIMPLE(108, Down)
  321. control alt keycode 83 = Boot
  322. control alt keycode 111 = Boot
  323. # Stock VT102 string definitions.
  324. string F1 = "\033[[A"
  325. string F2 = "\033[[B"
  326. string F3 = "\033[[C"
  327. string F4 = "\033[[D"
  328. string F5 = "\033[[E"
  329. string F6 = "\033[17~"
  330. string F7 = "\033[18~"
  331. string F8 = "\033[19~"
  332. string F9 = "\033[20~"
  333. string F10 = "\033[21~"
  334. string F11 = "\033[23~"
  335. string F12 = "\033[24~"
  336. string F13 = "\033[25~"
  337. string F14 = "\033[26~"
  338. string F15 = "\033[28~"
  339. string F16 = "\033[29~"
  340. string F17 = "\033[31~"
  341. string F18 = "\033[32~"
  342. string F19 = "\033[33~"
  343. string F20 = "\033[34~"
  344. string Find = "\033[1~"
  345. string Insert = "\033[2~"
  346. string Remove = "\033[3~"
  347. string Select = "\033[4~"
  348. string Prior = "\033[5~"
  349. string Next = "\033[6~"
  350. string Macro = "\033[M"
  351. string Pause = "\033[P"
  352. # Stock ISO-8859-1 compositions.
  353. changequote()dnl
  354. compose '`' 'A' to 'À'
  355. compose '`' 'a' to 'à'
  356. compose '\'' 'A' to 'Á'
  357. compose '\'' 'a' to 'á'
  358. compose '^' 'A' to 'Â'
  359. compose '^' 'a' to 'â'
  360. compose '~' 'A' to 'Ã'
  361. compose '~' 'a' to 'ã'
  362. compose '"' 'A' to 'Ä'
  363. compose '"' 'a' to 'ä'
  364. compose 'O' 'A' to 'Å'
  365. compose 'o' 'a' to 'å'
  366. compose '0' 'A' to 'Å'
  367. compose '0' 'a' to 'å'
  368. compose 'A' 'A' to 'Å'
  369. compose 'a' 'a' to 'å'
  370. compose 'A' 'E' to 'Æ'
  371. compose 'a' 'e' to 'æ'
  372. compose ',' 'C' to 'Ç'
  373. compose ',' 'c' to 'ç'
  374. compose '`' 'E' to 'È'
  375. compose '`' 'e' to 'è'
  376. compose '\'' 'E' to 'É'
  377. compose '\'' 'e' to 'é'
  378. compose '^' 'E' to 'Ê'
  379. compose '^' 'e' to 'ê'
  380. compose '"' 'E' to 'Ë'
  381. compose '"' 'e' to 'ë'
  382. compose '`' 'I' to 'Ì'
  383. compose '`' 'i' to 'ì'
  384. compose '\'' 'I' to 'Í'
  385. compose '\'' 'i' to 'í'
  386. compose '^' 'I' to 'Î'
  387. compose '^' 'i' to 'î'
  388. compose '"' 'I' to 'Ï'
  389. compose '"' 'i' to 'ï'
  390. compose '-' 'D' to 'Ð'
  391. compose '-' 'd' to 'ð'
  392. compose '~' 'N' to 'Ñ'
  393. compose '~' 'n' to 'ñ'
  394. compose '`' 'O' to 'Ò'
  395. compose '`' 'o' to 'ò'
  396. compose '\'' 'O' to 'Ó'
  397. compose '\'' 'o' to 'ó'
  398. compose '^' 'O' to 'Ô'
  399. compose '^' 'o' to 'ô'
  400. compose '~' 'O' to 'Õ'
  401. compose '~' 'o' to 'õ'
  402. compose '"' 'O' to 'Ö'
  403. compose '"' 'o' to 'ö'
  404. compose '/' 'O' to 'Ø'
  405. compose '/' 'o' to 'ø'
  406. compose '`' 'U' to 'Ù'
  407. compose '`' 'u' to 'ù'
  408. compose '\'' 'U' to 'Ú'
  409. compose '\'' 'u' to 'ú'
  410. compose '^' 'U' to 'Û'
  411. compose '^' 'u' to 'û'
  412. compose '"' 'U' to 'Ü'
  413. compose '"' 'u' to 'ü'
  414. compose '\'' 'Y' to 'Ý'
  415. compose '\'' 'y' to 'ý'
  416. compose 'T' 'H' to 'Þ'
  417. compose 't' 'h' to 'þ'
  418. compose 's' 's' to 'ß'
  419. compose '"' 'y' to 'ÿ'
  420. compose 's' 'z' to 'ß'
  421. compose 'i' 'j' to 'ÿ'
  422. # ISO-8859-3 compositions for Esperanto.
  423. compose 'C' 'x' to 'Æ' #198
  424. compose 'G' 'x' to 'Ø' #216
  425. compose 'H' 'x' to '¦' #166
  426. compose 'J' 'x' to '¬' #172
  427. compose 'S' 'x' to 'Þ' #222
  428. compose 'U' 'x' to 'Ý' #221
  429. compose 'c' 'x' to 'æ' #230
  430. compose 'g' 'x' to 'ø' #248
  431. compose 'h' 'x' to '¶' #182
  432. compose 'j' 'x' to '¼' #188
  433. compose 's' 'x' to 'þ' #254
  434. compose 'u' 'x' to 'ý' #253