1

For example, in my xterm to get:

000: Ctrl+Space or Ctrl+@

001: Ctrl+A

002: Ctrl+B

003: Ctrl+C

004: Ctrl+D

005: Ctrl+E

006: Ctrl+F

007: Ctrl+G

008: Ctrl+H

009: Ctrl+I or Tab

010: Ctrl+J or Ctrl+M or Enter

011: Ctrl+K

012: Ctrl+L

013: can't find any.

014: Ctrl+N

015: Ctrl+O

016: Ctrl+P

017: Ctrl+Q

018: Ctrl+R

019: Ctrl+S

020: Ctrl+T

021: Ctrl+U

022: Ctrl+V

023: Ctrl+W

024: Ctrl+X

025: Ctrl+Y

026: Ctrl+Z

027: Ctrl+[ or Esc

028: Ctrl+\

029: Ctrl+]

030: Ctrl+^

031: Ctrl+_ or Ctrl+/

Characters from 032 to 127, inclusively, are all printable, but there are some that can be referred in multiple ways using either Ctrl, Shift or Alt or a combination of those.

Then there are characters from 128 to something I don't know.


Test script:

#!/usr/bin/env python3

import curses
import os


def main(stdscr):
    curses.raw()
    while True:
        stdscr.addstr(0, 0, str(stdscr.getch()))
        stdscr.refresh()


if __name__ == "__main__":
    os.environ.setdefault('ESCDELAY', '0')
    curses.wrapper(main)
  • 4
    AFAIK, in Xterm (or any decent terminal emulator) <U+000D> is ^M (Control-M) or <Enter>. You don't have to set any environment variable to make <Esc> or ^[ produce <U+001B>. To test, start vim, enter insert mode (i) and press ^V <Esc>; you will get an <U+001B> instantly. Also, you can extend your table to <U+001F>: ^\ , ^], ^^, ^_ (that is, control-\ , control-], control-^ and control-_). This has been so since the beginning of time, when terminals where real pieces of hardware. – AlexP Nov 28 '17 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.