Mac – How to change key mapping behavior of macvim

keybindingsmacvim

In Ubuntu, if I hit Shift + Alt + A while in insert mode, it moves the cursor to the end of the line and stays in insert mode. Shift + Alt + I does the same for moving to the beginning of the line.

But in macvim, Shift + Alt + A produces this character: Å, and Shift + Alt + I produces a carat ^.

I would very much like to keep the vim key mapping behavior consistent between my Mac, and my Ubuntu machine at work, but I can't figure out how to do so.

Is there a way I can make vim clobber any of Mac's keybindings so that they remain purely vim keybindings? Note that the above key combination does the same thing even in this input field, so it seems this is a global thing in Mac that I would like to disable if possible.

Best Answer

I am an idiot...

I can just map the special characters...

imap Å <ESC><S-a>
imap ˆ <ESC><S-i>

Problem solved.

That said, apparently if you have macvim gui, you can use set macmeta in your vimrc and then do things like imap <S-M-a> <ESC><S-a> which will work in theory, but I prefer to work in terminal and unfortunately macmeta is not available in terminal macvim