I'm running vim on a Linux VM that I'm ssh'd into via Mac OS X's Terminal app, and I want to configure it to do useful things with my arrow keys (among others).
For example, I want option-left to move the cursor back one word, similarly to how it works in other Mac applications.
In normal mode, this is easy enough; I can simply map the sequence to
b. But when I'm in insert mode, I want to stay in insert mode (i.e., map the sequence to
In my .vimrc` file, I have these lines:
nmap ^[[xol~ b
imap ^[[xol~ <c-o>b
^[[xol~ is the character sequence that I've configured Terminal to send when I press option-left.
This works, but it gets pretty tedious, especially when I've got nearly two dozen commands that I want to map.
Is there a better way to do this?