Wednesday, September 9, 2015

macos - How to bindkey alt+key in OSX


I am using oh-my-zsh configuration which has some handy bindkey condiguration. For example: "^[B" backward-word. On Linux I can use it with ease, but on OSX when I press alt-B i get some chars instead moving cursor. Can I configure somehow shortcuts alt+key on OSX or is there any trick to use them of of the box?


Answer



M-b and M-f should be bound to backward-word and forward-word by default:


$ 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

You just have to change the meta key:




No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...