MacOS – MacVim — how to make Ctrl+A go to beginning of line, Ctrl+E to the end of the line

keyboardmacosmacvim

I'm trying to switch to MacVim as my main editor, and I'm liking it so far, except for one issue:

I got really used to the Mac shortcuts controlA to go to the beginning of a line, and controlE to go to the end of a line.

However, these two don't work in MacVim (controlA does something weird — it seems to increase the last number in a line by 1 or something, and controlE seems to scroll down the screen by one line).

Any way to make these two shortcuts go to the beginning of a line / end of a line respectively instead?

Best Answer

Add the following to .vimrc or .gvimrc:

:" Map Ctrl-A -> Start of line, Ctrl-E -> End of line
:map <C-a> <Home>
:map <C-e> <End>