Using Vim in Terminal on Mac OS X, my Option+Left Arrow skips words as expected, but my Option+Right Arrow does nothing. How can I fix this?
I'm not really sure if you want to change the default behavior as this isn't going to work very well in other terminal applications.
Option+Left moves back a word because vim sees it as esc+b. (seems to be the default in Terminal). So if you are in insert mode you are popped out to normal mode and than b is executed which is move back a word. If you are in normal mode the escape does nothing and b moves you back a word.
Option+Right looks like it does nothing because vim sees it as esc+f. The f causes vim to wait for the next letter and if you entered something right after the f you would move forward to find that letter.
One way to change it is to go into Terminals preferences and change what Option+Right is mapped to. You can do this by going to Preferences -> Settings -> Select Current Profile -> Keyboard. At this point you can either edit "option cursor right" or add a new "option cursor right" (by clicking the plus this will overwrite the actual one). And set the mapping to
\033w by typing esc+w. Then hit ok with the mouse. (Hitting enter will cause the enter key to be absorbed by the text box. You do not want that)
After this is done open a new tab and Option+Right will do what you want in vim but probably won't do what you want anywhere else. (it might though)
One other way is to change the mappings to Control+Left and Control+Right. Normally in vim these are mapped to B and W respectively. To do this follow the instruction I wrote for Is there any way to go word by word using `Ctrl + ->`
Although learning how to use vim with only the keyboard is probably better.
As of OS X Mojave 10.14.5, there is a much simpler solution:
You actually don't need to change anything in mac preferences. After a lot of experimentation it appears that all you need to do is put
:map f w in your .vimrc file!
For some reason specifying the escapes is unnecessary and actually interfered with expected behaviour for me. Doing what I suggested will automatically escape and do a forward-word on an alt+Right key entry (and of course the opposite currently does work automatically).