0

If I ssh into a Linux box I can move back a word in the CLI using OptionBackspace.

Is there a way I can do this in the Mac's Terminal? Every time I press OptionBackspace, [D returns.

3

esc + b is the key binding to go back a word.

esc + f moves forward.

2

In your Terminal's preferences, set the following keyboard mapping if it's not already set:

Your Option cursor left should map to \033b, and Option cursor right to \033f. Now, pressing Option and Option will move back or forward a word, like they do in normal text editing windows.

If you additionally tick Use option as meta key, pressing OptionB and OptionF will have the same effect, since these are the standard shell bindings for word movement.

Of course, if you really want Option to move back a word (and not delete it), then map this combination to \033b instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.