Skip to content

Instantly share code, notes, and snippets.

@grandchild
Created October 22, 2020 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grandchild/6ea1a8cc11c94c65602ee140f510df7a to your computer and use it in GitHub Desktop.
Save grandchild/6ea1a8cc11c94c65602ee140f510df7a to your computer and use it in GitHub Desktop.
Note the difference between the urxvt-unicode sessions, one with $TERM set to 'rxvt', the other with the default value!
As stated previously, AltLeft/-Right don't work in TTY mode, because they switch between ttys.
■ ./test_keys.zsh
TERM=linux
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
x Application mode is not supported
) F1: ^[[[A
) F2: ^[[[B
) F3: ^[[[C
) F4: ^[[[D
) F5: ^[[[E
) F6: ^[[17~
) F7: ^[[18~
) F8: ^[[19~
) F9: ^[[20~
) F10: ^[[21~
) F11: ^[[23~
) F12: ^[[24~
) Backspace: ^?
) Delete: ^[[3~
) Insert: ^[[2~
) Home: ^[[1~
) End: ^[[4~
) PageUp: ^[[5~
) PageDown: ^[[6~
) Up: ^[[A
) Left: ^[[D
) Down: ^[[B
) Right: ^[[C
! AltLeft: not defined, and skipped
! AltRight: not defined, and skipped
x ControlLeft: not defined, but got ^[[D
x ControlRight: not defined, but got ^[[C
x ShiftTab: Got \t, but expected ^[[Z
❯ ./test_keys.zsh
TERM=rxvt
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
) Started application mode
) F1: ^[[11~
) F2: ^[[12~
) F3: ^[[13~
) F4: ^[[14~
) F5: ^[[15~
) F6: ^[[17~
) F7: ^[[18~
) F8: ^[[19~
) F9: ^[[20~
) F10: ^[[21~
) F11: ^[[23~
) F12: ^[[24~
x Backspace: Got ^?, but expected ^H
) Delete: ^[[3~
) Insert: ^[[2~
) Home: ^[[7~
) End: ^[[8~
) PageUp: ^[[5~
) PageDown: ^[[6~
) Up: ^[[A
) Left: ^[[D
) Down: ^[[B
) Right: ^[[C
x AltLeft: not defined, but got ^[^[[D
x AltRight: not defined, but got ^[^[[C
) ControlLeft: ^[Od
) ControlRight: ^[Oc
) ShiftTab: ^[[Z
) Ended application mode
❯ ./test_keys.zsh
TERM=rxvt-unicode-256color
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
) Started application mode
) F1: ^[[11~
) F2: ^[[12~
) F3: ^[[13~
) F4: ^[[14~
) F5: ^[[15~
) F6: ^[[17~
) F7: ^[[18~
) F8: ^[[19~
) F9: ^[[20~
) F10: ^[[21~
) F11: ^[[23~
) F12: ^[[24~
) Backspace: ^?
) Delete: ^[[3~
) Insert: ^[[2~
) Home: ^[[7~
) End: ^[[8~
) PageUp: ^[[5~
) PageDown: ^[[6~
) Up: ^[[A
) Left: ^[[D
) Down: ^[[B
) Right: ^[[C
x AltLeft: not defined, but got ^[^[[D
x AltRight: not defined, but got ^[^[[C
x ControlLeft: not defined, but got ^[Od
x ControlRight: not defined, but got ^[Oc
) ShiftTab: ^[[Z
) Ended application mode
❯ ./test_keys.zsh
TERM=xterm
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
) Started application mode
) F1: ^[OP
) F2: ^[OQ
) F3: ^[OR
) F4: ^[OS
) F5: ^[[15~
) F6: ^[[17~
) F7: ^[[18~
) F8: ^[[19~
) F9: ^[[20~
) F10: ^[[21~
) F11: ^[[23~
) F12: ^[[24~
) Backspace: ^H
) Delete: ^[[3~
) Insert: ^[[2~
) Home: ^[OH
) End: ^[OF
) PageUp: ^[[5~
) PageDown: ^[[6~
) Up: ^[OA
) Left: ^[OD
) Down: ^[OB
) Right: ^[OC
) AltLeft: ^[[1;3D
) AltRight: ^[[1;3C
) ControlLeft: ^[[1;5D
) ControlRight: ^[[1;5C
) ShiftTab: ^[[Z
) Ended application mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment