Reputation: 6181
Having done a little research on this, I know that option+left arrow and option+right arrow do not by default move by word in the OS X Terminal application. But mine did, until about a week ago.
The only thing that's changed is oh-my-zsh updated. I see that it has
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
defined but I don't know what those keys are. GitHub's last recorded change to the file was 24 days go and not related to those keys, so this must predate the latest update.
I have also tried the "Use option as meta key" option under Preferences > Settings > Keyboard. That only results in printing [D
and [C
when I hit option+left arrow and option+right arrow.
Upvotes: 10
Views: 11795
Reputation: 659
Macos Sequoia 15.1
In my case in Terminal (and Vscode IDE integrated terminal) only Left Option + Left/Right arrow
move by word, while Left Control + Left/Right arrow
insert ugly ;5D
and ;5C
.
Here is Karabiner rule to fix that
{
"description": "Change 'Control + Left/Right' to 'Option + Left/Right'",
"manipulators": [
{
"from": {
"key_code": "left_arrow",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["left_option"]
}
],
"type": "basic"
},
{
"from": {
"key_code": "right_arrow",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_option"]
}
],
"type": "basic"
}
]
}
You can add this rule in Karabiner UI like that:
Upvotes: 0
Reputation: 3192
One way to fix your issue is to:
Terminal.app > preferences > Settings > Keyboard
there's a Key -> Action list.option cursor left
and option cursor right
and set their values to \033b
and \033f
respectively.Upvotes: 18