0

I'm trying to create readline macros and bindings, but struggling to find codes for some key sequences. How to find codes for key combinations, like "\e[1;2A" for Shift-Up, etc?

By the way, I have enabled convert-meta option.

0

1 Answer 1

0

You get the literal value of a keypress if you prefix it by Ctrl+v. For example, pressing Ctrl+v followed by Shift+Up-arrow might generate the text ^[[1;2A in the terminal, where the initial ^[ is a literal escape character (which you would write as \e). In the same manner, an unshifted Right-arrow may generate ^[[C, i.e., \e[C.

2
  • Thank you! I had to enable echo-control-characters option, but still unable to see some codes, like Alt-Tab, Alt-A ("\eA" works only for esc A though) Commented Feb 12 at 13:22
  • @Alex I don't think Alt+Tab generates anything different than an ordinary Tab character. Commented Feb 12 at 13:41

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.