---
created_at: '2017-05-18T13:56:23.000Z'
title: History of Emacs and vi Keys (2010)
url: http://xahlee.info/kbd/keyboard_hardware_and_key_choices.html
author: McMini
points: 130
story_text: 
comment_text: 
num_comments: 85
story_id: 
story_title: 
story_url: 
parent_id: 
created_at_i: 1495115783
_tags:
- story
- author_McMini
- story_14367207
objectID: '14367207'

---
[Source](http://xahlee.info/kbd/keyboard_hardware_and_key_choices.html "Permalink to History of Emacs and vi Keys")

# History of Emacs and vi Keys

[▲ Xah Keyboard Guide][1]

# History of Emacs and vi Keys

By Xah Lee. Date: 2010-06-16. Last updated: 2017-05-22.

In my study of keyboarding in the past 20 years, i've noticed that the choices of many shortcuts in many apps are adopted to the many aspects of the keyboard hardware of the time in use by the community. Emacs's keybinding is not simply based on the first letter of commands, but the QWERTY layout's key positions have significant influence on it. This also applies to the letter choice of unix's shell commands. Much of this influences of design are unconscious.

## Emacs's Meta and Control

As a example, emacs's Meta key, and heavy use of Control as primary modifier, and avoiding any 【Ctrl+Shift+‹letter›】 in its keyboard shortcuts, are caused by the lisp keyboard hardware and dumb terminals of 1980s. [see [List of Emacs Default Keybinding][2]]

![lisp-machine-keyboard-1][3] Symbolics's lisp machine keyboard PN 365407 Rev C. Photo by [Joey Devilla][4]. Used with permission.  ![lisp-machine-keyboard-2-left][5] Left side. ![lisp-machine-keyboard-4-right][6] Right side. Note the dedicated parenthesis keys.

For more Lisp Machine keyboard photos, see: [Lisp Machine Keyboards][7].

### How did emacs's cursor movement keys {C-n, C-p, C-f, C-b} came about?

> … At the time [1976] [Guy Steele][8] put together the Emacs default key mappings, many people in the target user community (about 20 people at MIT!) were already using these key bindings. It would have been hard to get the new Emacs bindings accepted by the community if they differed for such basic commands. As you point out, anyone using Emacs can very easily change this based on their own ergonomic preferences.
> 
> From [• emacs keybinding 2008-06-01 By Daniel Weinreb. At <http://groups.google.com/group/comp.emacs/msg/0342e0bc1aa05c0d> , Accessed on 2012-09-08 ]

[see [Lisp Programer Daniel Weinreb Died (1959 – 2012)][9]]

### Why emacs doesn't have any Control+Shift+letter key?

Because, in terminal, Control+Shift+letter has the same signal as Control+letter.

* [Why Emacs's Keyboard Shortcuts are Painful][10]
* [on vi Keybinding vs Emacs Keybinding][11]

## vi's Esc key and j k h l

### How did vi's mode switching idea came from?

Back in 1970s, terminal screen are 80 columns by 24 lines. There's no real-time editing. You edit by typing a command, then call another command to have the screen update to show the result of your command. Vi's "modal editing" is evolved from this. This is also why emacs's manual calls itself "Real Time Display Editor". Emacs is the first or one of the first "Real Time Display" editor.

![terminal ADM-3A][12] The ADM-3A terminal. (12 inch screen; 24 lines of 80 characters.) [2676×2370][13] • [image source][14]

### Why vi uses j k h l for cursor movement?

Unix vi's use of j k h i for cursor movement, and the choice of Escape key for mode switching, came from the keyboard it was developed on, the [ADM-3A terminal][15] (1975).

![terminal ADM-3A keyboard][16] Terminal ADM-3A keyboard. Note the position of the Escape key and the arrows on H J K L, also the position of Ctrl. ![terminal ADM 3A number pad][17] Terminal ADM-3A number pad. ![terminal ADM-3A keyboard layout][18] The ADM-3A terminal's keyboard layout. [image source][19]

### Why does the keyboard use {H J K L} for arrow instead of {I J K L}?

The reason appears to be heavily influenced by the design of the ASCII encoding, which involved a clever assignment of binary code to the letters so that if you tweak one bit, the characters A to Z corresponds to the non-printable character starting with code 0. Some of the non-printable character by some choice interpretation corresponds to arrow directions, and the corresponding letter are H J K L.

> jgrahamc wrote
> 
> The reason that keyboard had those arrows keys on it was because those keys correspond to CTRL-H, J, K, L and the CTRL key back then worked by killing bit 6 (and bit 5) of the characters being typed.
> 
> The effect was that H which is ASCII 0x48 would become 0x08 which is backspace. If you look at an ASCII table (e.g. http://www.asciitable.com/) you will notice how the uppercase ASCII letters line up nicely with the control characters so that just dropping bit 6 will get you there. Same thing with the lowercase (drop bits 5 and 6) and you are on the control characters.
> 
> The CTRL-H, J, K, L therefore correspond to BS, LF, VT, FF. BS is backspace (i.e. left), LF (down), VT is vertical tab (so up) and FF is form feed (which in this case takes you <s>up</s> [right]). I'm not sure why FF was used for <s>up</s> [right].
> 
> This is also why CTRL-I is tab, CTRL-D ends a communication. All of that goes back to teletype days. Also for telnet users out there you'll see that CTRL-[ lines up nicely with ESC. And when you see a ^@ being printed on the terminal you can see why it corresponds to a null byte.
> 
> One other interesting thing about ASCII: uppercasing and downcasing can be done by twiddling a single bit.
> 
> If you look at this picture of an ASR-33 Teletype you'll see that come of the control characters on the keyboard correspond to those in the ASCII set. This is because ASCII evolved from the earlier teletype character sets: <https://upload.wikimedia.org/wikipedia/commons/0/0b/ASR-33_2.jpg>
> 
> [source: <https://news.ycombinator.com/item?id=3684515> ([local copy][20])]

| ----- |
| ◇ | ← | ↓ | ↑ | → |  
| ASCII Control Char | backspace | linefeed | vertical tab | formfeed |  
| decimal | 8 | 10 | 11 | 12 |  
| binary | 00001000 | 00001010 | 00001011 | 00001100 |  
| Input Method | Ctrl+h | Ctrl+j | Ctrl+k | Ctrl+l |  
| ◇ | h | j | k | l |  
| decimal | 104 | 106 | 107 | 108 |  
| binary | 01001000 | 01001010 | 01001011 | 01001100 | 

see [ASCII Table][21]

See also: [on vi Keybinding vs Emacs Keybinding][11]

The above does not fully answer why the ADM-3A terminal keyboard has arrows printed on the H J K L keys. To really know, one must read the ADM-3A terminal manual.

![ADM 3A terminal manual arrow keys][22] "ADM-3A interactive display terminal, OPERATORS MANUAL", on arrow keys 

So, apparantly, the arrows keys are used with control key held down. It simply sends the corresponding ASCII control codes, and these 4 control codes, are interpreted to move cursor.

The vi designer Bill Joy, simply used the same key in vi's modal way, without needing to hold Control key.

* [Arrow Keys Efficiency: vim HJKL vs IJKL][23]
* [Emacs vs vim, Compute Keybinding Efficiency][24]

## Terminal Keys

Many of the terminal keys in Linux we are familiar today, are not keyboard shortcuts or keybindings proper. They are simply input method for ASCII control characters. For example, 【Ctrl+d】 exits the terminal, but only if the cursor is at the beginning of the prompt.

For detail, see: [Linux: Terminal Control Sequence Keys][25].

## Gaming's W A S D

The gaming's convention of W A S D for avatar movement keys, is also shaped by the PC keyboard's physical key layout used at the time.

![wasd keys transculent top keycaps 0026][26]

Most people need to use the right hand for the mouse for operating a gun or view, so the left hand is used for controlling the avatar's movement. Right hand is the more dexterous hand for most people, and operating the mouse needs more dexterity than pressing arrow keys.

So, to move the avatar, there's the arrow keys, but those have some problems. The arrow keys are on the right side of the keyboard, making it awkward to use with left hand. So, a cluster of keys on the left side of the keyboard is used instead.

But why
    
    
       W
     A S D

and why not for example:
    
    
       E
     S D F

keys? The E S D F are in the standard typing position. But, W A S D is more suitable here, because W A S D is closer to {Caps Lock, Tab, Shift, Ctrl, Alt}, that gamers need to use for Firing, Shield, Jump, change weapon, etc. So, W A S D became the convention.

Also note that the common layout is QWERTY. W A S D is inverted T on QWERTY layout. For those using the [Dvorak Keyboard Layout][27], the W A S D keys are scattered and is a problem. In fact, in the early days, many games do not respect user's choice of key layout in Operating System, nor does it provide ways for users to change the keys. Even today, some game software still have this problem, notably [Second Life][28] (as of 2010-06-16). (In the early days, say mid 1990s, Operating systems such as Windows hardly have a consistent keyboard layout API for programers anyway. Many software protocols, standards, layers, are gradually established later as with most things.)

## The X C V for Cut Copy Paste

Another history is the convention of X C V keys for Cut Copy Paste. This came from Apple.

![Apple IIe keyboard][29] Apple IIe. (1983) (img src <s>http://www.vectronicsappleworld.com/collection/appleiiplatinum.html</s>) 
    
    
    Q W
     A S D
      Z X C V

Apple computer, starting in late 1980s, made the {undo, cut, copy, paste} concept popular to the masses, and in general the concept of computer keyboard shortcuts. These keys are chosen because they are all adjacent and on the left side of the keyboard, where under them there's the ⌘ command key. Also in this set are Quit Q, Close W, Select All A, Save S, Duplicate D, and Undo Z. The only exceptions are Open O and Print P on the right side of keyboard.

All these keys have become de facto standard on all applications on {Windows, Mac, Linux} today, except the 【Ctrl+Shift+z】 for redo and D for Duplicate.

See: [Cut, copy, and paste][30].

See also: [Control Key and Capslock Key Positions in Old Keyboards][31]

## Windows's PrtScn/SysRq for Screenshot

![Backspace Insert PrtScn keys][32] Print Screen/SysRq, Scroll Lock, Pause/Break, Insert

On today's PC keyboard, you'll find quite a few relic keys. Print Screen/SysRq, Scroll Lock, Pause/Break, Insert. They used to have meaningful purposes in the 1980 or earlier, some of them are separate keys. But computer hardware changes, and software changes, dramatically over the past 20 years. Keyboard itself did not change as fast, due to habit. So, these keys became defunct.

Because the name "Print Screen" somewhat relates to screen capture, so Microsoft have chosen it to be the key for saving screenshots. Similarly, the ⌫ Backspace key, was chosen as the key for web browser to go BACK to previous page. Note that this key is labeled "Delete" on Apple's keyboards, even they sent the exact same signal. In Apple's operating system, in Mac Classic of the 1990s or Mac OS X since early 2000s, this key was not used for browser's back function, only so around ~2006 when Apple started to adopt many Windows's conventions.

See also:

* [Difference Between Apple and PC keyboards][33]
* [Backspace Key: Key Label's Influence on Key Purpose][34]

## Conclusion?

If there's any conclusion, it is that many keyboard shortcut or hotkey choices are based on what is practical at the time. Issues of logical design, ergonomics, consistency, efficiency, are less important. Some of these concept didn't even exist at the time, and some choice was good at the time but computer systems and hardware and keyboard all have changed.

In retrospect, many of the choices are not the best today. For example, QWERTY layout was practical at the time, but the Dvorak Layout was invented too late, when convention was already established, and concept of keyboard ergonomics may not even exist. But typing on computer is done by everyone today, for chatting, emails, all sorts of communication, and programing has become a field that's some million times more than the number of typists 40 years ago.

[see [Dvorak Keyboard Layout][27]]

Emacs's primary modifier the Ctrl is much better at the Alt position on today's PC keyboards.

"vi"'s Escape might be better today at PC keyboard's Alt or Caps Lock positions. vi's {h j k l} is still pretty good, but {i j k l} is equally efficient but more intuitive. [see [Arrow Keys Efficiency: vim HJKL vs IJKL][23]]

The way Caps Lock work should be deprecated. It should work as a key to capitalize the next letter key press. (not as a "lock") This way, Shift can be entirely removed.

Any modifier keys such as {Shift, ❖ Window, …} should be deprecated. Instead, they should just be special keys, as starting key for a key sequence to call commands. (like how Microsoft Windows's Alt key works (from about Windows 95 to Windows 7).) [see [Banish Key Chords][35]]

The defunct keys: Insert, Print Screen, Scroll Lock, Pause, Break, really should be gone. [see [Print Screen, SysRq/ScrLk, Pause/Break Keys][36]] The Num Lock on the number keypad also is a relic, from a time long past that keyboards don't have dedicate arrow keys and Page up/down Home/End etc keys.

Today, there needs to be keys to change sound level, play/pause music, next/previous song. Luckily, these have been on most keyboards since about mid 2000s, just that they have not been standardized in layout. Similarly, there needs keys to launch frequently used apps such as email, web browser. These have also been widely popular in keyboards. There needs to be keys to switch to previous next app/window/tab. Also needed is dedicated keys for {copy, cut, paste, undo, redo}. These are used in about every application on a hourly basis. Major keyboard makers Microsoft and Logitech have started to make keyboards with these functions pre-assigned to the F1 to F12 Function keys. However, it creates problems because these function keys already have uses in many applications, especially for programers. Microsoft also introduced the F-Lock key to toggle the purpose of the F function keys, but that created more problem than is worth. [see [The F-Lock Key Problem][37]]

* * *

2013-07-17

2013-07-17 addendum: Hacker News discussion. <https://news.ycombinator.com/item?id=6056420>

2013-07-29 thanks to [Liam Proven][38] for correction on Apple keyboard photo used.

* * *

2017-05-18

2017-05-18 addendum: Hacker News discussion. <https://news.ycombinator.com/item?id=14367207>

#### Hacker Lore Keyboards

1. [History of Emacs and vi Keys][39]
2. [Lisp Machine Keyboards][7]
3. [Symbolics Space-Cadet Keyboard][40]
4. [How to Create APL or Math Symbols Keyboard Layout][41]
5. [Univac F-1355-00 Keyboard][42]
6. [Ann Arbor Ambassador 60 Terminal][43]
7. [ADM-3A Terminal][44]
8. [DEC VT100 Terminal][45]
9. [IBM Model M keyboard][46]
10. [Sun Microsystems Type 6 Keyboard][47]
11. [Control Key and Capslock Key Positions in Old Keyboards][31]
12. [The Idiocy of Happy Hacking Keyboard][48]

Did it help?  
  
Tip me, at [patreon][49]   

Ask me question on [patreon][49]

∑XAH

© 1995, …, 2018 Xah Lee.

[1]: http://xahlee.info/keyboarding.html
[2]: http://ergoemacs.org/emacs/gnu_emacs_keybinding.html
[3]: http://xahlee.info/i_old_keyboard_22509/lisp-machine-keyboard-1.jpg
[4]: http://www.globalnerdy.com/2009/02/05/hacklabtos-lisp-machine-keyboard/
[5]: http://xahlee.info/i_old_keyboard_22509/lisp-machine-keyboard-2-left.jpg
[6]: http://xahlee.info/i_old_keyboard_22509/lisp-machine-keyboard-4-right.jpg
[7]: http://xahlee.info/lisp_keyboards.html
[8]: http://en.wikipedia.org/wiki/Guy_L._Steele_Jr.
[9]: http://ergoemacs.org/misc/Daniel_Weinreb_died.html
[10]: http://ergoemacs.org/emacs/emacs_kb_shortcuts_pain.html
[11]: http://ergoemacs.org/misc/on_vi_keybinding.html
[12]: http://xahlee.info/i_old_keyboard_22509/terminal_ADM-3A-s.jpg
[13]: http://xahlee.info/i_old_keyboard_22509/terminal_ADM-3A.jpg
[14]: http://en.wikipedia.org/wiki/File:Adm3aimage.jpg
[15]: http://en.wikipedia.org/wiki/ADM-3A
[16]: http://xahlee.info/i_old_keyboard_22509/terminal_ADM-3A_keyboard.jpg
[17]: http://xahlee.info/i_old_keyboard_22509/terminal_ADM-3A_number_pad.jpg
[18]: http://xahlee.info/i_old_keyboard_22509/terminal_ADM-3A_keyboard_layout.svg
[19]: http://en.wikipedia.org/wiki/File:KB_Terminal_ADM-3A.svg
[20]: http://ergoemacs.org/misc/i/hackernews_why_vi_terminal_adm_3a_uses_ijkl.txt
[21]: http://xahlee.info/comp/ascii_table.html
[22]: http://xahlee.info/i/ADM-3A_terminal_manual_arrow_keys.png
[23]: http://xahlee.info/vi_hjkl_vs_inverted_t_ijkl_arrow_keys.html
[24]: http://xahlee.info/efficiency_of_keybinding_emacs_vs_vim.html
[25]: http://xahlee.info/linux/linux_terminal_control_sequence_keys.html
[26]: http://xahlee.info/i2/wasd_keys_transculent_top_keycaps_0026.jpg
[27]: http://xahlee.info/keyboard_dvorak_layout.html
[28]: http://xahsl.org/index.html
[29]: http://xahlee.info/i/Apple_IIe_keyboard.jpg
[30]: http://en.wikipedia.org/wiki/Cut,_copy,_and_paste
[31]: http://xahlee.info/keyboard_ctrl_vs_capslock_position.html
[32]: http://xahlee.info/i/Backspace_Insert_PrtScn_keys.jpg
[33]: http://xahlee.info/apple_pc_kb_diff.html
[34]: http://xahlee.info/keyboard_key_label_significance.html
[35]: http://xahlee.info/banish_key_chords.html
[36]: http://xahlee.info/keyboard_PrtScn_SysRq_ScrLk_Pause_Break_keys.html
[37]: http://xahlee.info/ms_keyboard/f-lock_key_problem.html
[38]: https://twitter.com/lproven
[39]: http://xahlee.info/keyboard_hardware_and_key_choices.html
[40]: http://xahlee.info/space-cadet_keyboard.html
[41]: http://xahlee.info/creating_apl_keyboard_layout.html
[42]: http://xahlee.info/univac_keyboard.html
[43]: http://xahlee.info/Ann_Arbor_Ambassador_60_terminal.html
[44]: http://xahlee.info/ADM-3A_terminal.html
[45]: http://xahlee.info/vt100_terminal.html
[46]: http://xahlee.info/ibm_model_m_keyboard.html
[47]: http://xahlee.info/sun_microsystems_keyboard.html
[48]: http://xahlee.info/idiocy_of_happy_hacking_keyboard.html
[49]: https://www.patreon.com/xahlee

