Comment by chappar

9 years ago

Does this mean that ^; and ^{ are also equivalent to ESC?

^{ is, but on my terminal ^; just prints out a ;

iTerm2, in vim 1.8

  • ^[ and ^{ do the same thing in Terminal.app (macOS Sierra) and vim 8.0. However, I get the bell sound (which generally denotes invalid input in macOS) for ^; and it prints nothing.

You have control characters for the characters from 64 to 95.

    Control-@ is 0.  
    Control-A is 1, through control-Z is 26.
    Control-[ is 27, escape.
    Control-\ is 28.
    Control-] is 29.
    Control-^ is 30.
    Control-_ is 31.

I guess it could in theory, on my keyboard, however, CTRL seems to override other control chars, so typing ^{ doesn't seem possible at all, at least without any hacks. (I don't have a US layout keyboard.)

According to the bit-wise AND at the end of the article it should, but it seems like there's more to it than just zeroing out the 'column' bits.

  • Not sure if this is specifically related, but-

    CTRL does not actually modify the character code sent from the keyboard. For letters, the same keycode (which maps to ASCII with a constant addition of 0x3D) is always sent. Another byte in the HID report contains bit flags for modifier keys (L/R CTRL, SHIFT, etc); the OS decides what happens after that.

    Note that this holds under USB HID.

    • Not on a modern PC, but on the machine ASCII was originally developed for I could definitely see the CTRL key just pulling one bit low on the keyboard encoder.