Bash Alt+Arrow keyboard combination not working in Terminal under Mojave

keyboardterminal

I just migrated to Mojave from El Capitan. I am a extensive user of Terminal application.

But I got a bad surprise in this application: the alt+ and alt+ that move cursor from one word to another do not work anymore.

Expected behaviour (what should happen)

Previously, using alt+ in this state (cursor is symbolised with |) :


one two three four|

Led to :


one two three |four

This works fine in Safari or other applications.

Example (what actually happens)

Using alt+ in this state :


one two three four|

Led to (in Terminal):


one two three fou|r

Terminal configuration

My terminal configuration did not change since Mojave installation (option key is not used as Meta key)

Question

Does anyone have a clue about what to change in my configuration and restore expected behaviour ?

Best Answer

Can you check:

Go to Terminal > Preferences... > Profiles > Keyboard

From this pannel, check those two lines:

Key = Alt+ Action = \033b

Key = Alt+ Action = \033f

enter image description here

They might have gone away so you may create them again, or edit and double check the key, the modifier, and the action associated:

enter image description here


As a workaround, (actually it could even be better, so that you don't need to reach for the arrow keys), you could use Esc+f (jump forward) and Esc+b (jump backward).

And because the Esc key is far to reach, for more convenience, map the Caps key to Esc key with Karabiner Elements.

So that you can jump back and forth with Caps+f and Caps+b.