Use left option key as ALT for VIM on mac


Use iterm2 and change the left option to ESC+

Once that done, left option will work as alt in the vim. But it will break your cursor movement in the shell, i.e., opt+left and opt+right won’t move cursor over words. To fix that, type in ‘cat’, type the key you want to bind, i.e., opt+left and opt+right. Then you’d get keycodes of them.

In .zshrc, add the following while changing the keycodes with what you got from the cat.

bindkey "^[^[[C" forward-word
bindkey "^[^[[D" backward-word


Leave a Reply

Your email address will not be published. Required fields are marked *