Re:History and Effective Use of Vim
by komali2 on Friday July 19, 2019 @04:09PM
(#20482010)
On a lot of machines, C-[ (control + left bracket) maps to escape. But some programs don't seem to acknowledge this? Like in firefox, doing that changes tabs, but in Emacs + evil mode it's how I "ESC."
[ Parent
| on HN ]
There's an interesting reason for this related to the ASCII table and bit shifting, but I can't find a description of the exact mechanism for it. H and [ are in the same column as escape and delete respectively, and control shifts the bits in the character codes by some amount. Maybe someone smarter than me can elucidate.
This table might help explain:
00 01 10 11
00000 NUL Spc @ `
00001 SOH ! A a
00010 STX " B b
00011 ETX # C c
00100 EOT $ D d
00101 ENQ % E e
00110 ACK & F f
00111 BEL ' G g
01000 BS ( H h
01001 TAB ) I i
01010 LF * J j
01011 VT + K k
01100 FF , L l
01101 CR - M m
01110 SO . N n
01111 SI / O o
10000 DLE 0 P p
10001 DC1 1 Q q
10010 DC2 2 R r
10011 DC3 3 S s
10100 DC4 4 T t
10101 NAK 5 U u
10110 SYN 6 V v
10111 ETB 7 W w
11000 CAN 8 X x
11001 EM 9 Y y
11010 SUB : Z z
11011 ESC ; [ {
11100 FS < \ |
11101 GS = ] }
11110 RS > ^ ~
11111 US ? _ DELNow split the second column, and you understand the keyboard layout of pre-microprocessor ASCII terminals like the Teletype 33¹ and vi's own ADM-3A²
011 010
0000 0 SP
0001 1 !
0010 2 "
0011 3 #
0100 4 $
0101 5 %
0110 6 &
0111 7 '
1000 8 (
1001 9 )
1010 : *
1011 ; +
1100 < ,
1101 = -
1110 > .
1111 ? /
¹ https://commons.wikimedia.org/wiki/File:TTY33ASR.jpg² https://catonmat.net/images/why-vim-uses-hjkl/lsi-adm3a-full...