3

After fresh reinstall of macOS (started with High Sierra, not updated up to Big Sur), I am unable to use Shift + ← and Shift + → in Terminal, it returns symbols instead of selecting one character on left or right side.

  • Shift + ← returns e[1;2C
  • Shift + → returns e[1;2D

I was unable to find fix, I have tried using Terminal and iTerm2.

How to fix this?

//EDIT: Mapping shift-right to \e[1;2C, and shift-left to \e[1;2D from this post does not work.

2 Answers 2

1

TL;DR - you need to add custom settings by going to iTerm Preferences > Profiles > Keys and add your new custom key-bindings.


In case you're interested to know every step, you should checkout the answer from stackoverflow.com, which in turn refers another answer from superuser sister-site! 😅

Refer answers by @Merlin and @danylokos in ref answer from stackoverflow

3
  • Thanks for the answer, however this does not solve the issue. Proposed solution uses some weird selection mode used by iTerm which I do not like - I just need to highlight the text using good old way using shift and arror. Also even if this will solve my issue, I cannot reproduce it in Terminal...
    – FN_
    Sep 4, 2021 at 0:05
  • "Good Old Way" was never selecting using shift and arrow keys! But anyways, this is called customising key-bindings. Alternatively, you can do it using external applications like screen or tmux Sep 4, 2021 at 9:12
  • I am not gonna argue about default behaviour of SHIFT and LEFT & RIGHT arrow keys, because it is used to extend the selection since MS-DOS...maybe earlier. But I am going to check screen or tmux, but it's strange to me that I need external app to fix native bahaviour... :/
    – FN_
    Sep 4, 2021 at 13:54
0

iTerm2 > Preferences > Profiles > Keys > Key Mappings > Presets > Terminal.app Compability

enter image description here

2
  • It would be helpful to readers as to how/why your "answer" provides a solution asked in the original question.
    – agarza
    Aug 25, 2022 at 21:46
  • do you mean it should be changed to Natural Text Editing for it to work in the expected(from question) way? Feb 19, 2023 at 13:50

You must log in to answer this question.

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