如何在 OSX 中绑定 alt+key

如何在 OSX 中绑定 alt+key

我正在使用 oh-my-zsh 配置,它有一些方便的 bindkey 配置。例如:“^[B”反向单词。在 Linux 上我可以轻松使用它,但在 OSX 上,当我按 alt-B 时,我得到的是一些字符而不是移动光标。我可以在 OSX 上以某种方式配置快捷键 alt+key 吗?或者有什么技巧可以将它们直接使用吗?

答案1

M-b并且应该默认M-f绑定到backward-wordforward-word

$ zsh
$ bindkey | grep -- -word  
"^W" backward-kill-word
"^X*" expand-word
"^[^H" backward-kill-word
"^[^_" copy-prev-word
"^[\$" spell-word
"^[." insert-last-word
"^[B" backward-word
"^[C" capitalize-word
"^[D" kill-word
"^[F" forward-word
"^[L" down-case-word
"^[S" spell-word
"^[T" transpose-words
"^[U" up-case-word
"^[_" insert-last-word
"^[b" backward-word
"^[c" capitalize-word
"^[d" kill-word
"^[f" forward-word
"^[l" down-case-word
"^[s" spell-word
"^[t" transpose-words
"^[u" up-case-word
"^[^?" backward-kill-word

您只需更改元键:

相关内容