ASCII control characters escape sequences in iTerm
Normally I work in Windows or Linux. Currently, I am working on an iMac. Rather than fighting years of muscle memory, I switched the Command and Control keys in the Keyboard preferences. Problem is now Control keys in iTerm don’t work. After some research I determined how to send Control characters with both Command and Control.
Note: I know this could use some screenshots. No time right now.
Here is how to make
Control-C work in iTerm when Control/Command have been switched:
- In the iTerm menu, go to Bookmarks->Manage Profiles.
- Click Keyboard Profiles->Global.
- Add a new mapping.
- In the Key field: Select hex code, and enter the ASCII code for lower case ‘c’: 0x63
- In the Modfier field: Check the box for Command.
- In the Action field: Select send hex code and enter the ASCII code for Control-C which is 3, also known as ETX or End of Text.
- Check the box for High interception priority.
- Click OK.
Some common ASCII Key Control Hex Codes for Terminal and pico/nano use:
- CTRL-C: 3 (ETX)
- CTRL-X: 18 (CAN)
- CTRL-D: 4 (EOT)
- CTRL-K: B (VT)
- CTRL-O: F (SI)
A list of Control keys and their ASCII equivalents is available at: http://www.cs.tut.fi/~jkorpela/chars/c0.html
A list of all 7-bit ASCII characters: http://www.neurophys.wisc.edu/comp/docs/ascii/ascii-printable.html