0

Using cat in Terminal.app in order to view the raw codes, I get the following:

$ cat
^[[D    # LEFT
^[[1;2D # S-LEFT
^[[C    # RIGHT 
^[[1;2C # S-RIGHT
^[[A    # UP
^[[A    # S-UP
^[[B    # DOWN
^[[B    # S-DOWN

where:

  • S is for the shift key
  • LEFT is for left arrow
  • RIGHT is for right arrow
  • UP is for up arrow
  • DOWN is for down arrow

Thus, the shift key is ignored in conjunction with the up and down arrows, but not with the left and right arrows.

I don't see anything under Terminal > Preferences > Profiles > keyboard that would explain this behaviour (following this answer, that is how I solved a similar problem).

I could probably use DefaultKeybinding.dict (see this other answer for example) but that doesn't explain the behaviour.

1

I'm not sure what there is to "explain". If you want them to be recognized, define them in your terminal profile.

The canonical list of ANSI keycodes I usually use is here:

https://github.com/timothybasanov/terminal-app-function-keys

 ⇧↑ \033[1;2A
 ⇧↓ \033[1;2B
1
  • Thanks, that helps. I think that my misunderstanding is that SHIFT is not a character (it doesn't appear in the ANSII code) but only a function key. Thus, if there is no action specified in the keyboard profile of Terminal.app, then nothing happens. For example, SHIFT+LELFT and SHIFT-RIGHT do appear in the list. There is still a question: what is the nature of a function key? – Antoine Jan 27 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .