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 control-A to go to the beginning of a line, and control-E to go to the end of a line.

However, these two don't work in MacVim (control-A does something weird -- it seems to increase the last number in a line by 1 or something, and control-E 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?

2 Answers 2


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>
  • 3
    I don't use mac, but you might want to use noremap instead of map, in case you ever want to map <Home> or <End> somewhere else. In addition, you might want to use imap (or inoremap) in addition so that the hotkeys work in insert mode.
    – Jacklynn
    Commented Jul 28, 2015 at 21:45

Those are actually emacs shortcuts that OSX is using, so you're asking how to emulate emacs key bindings in vim, which is a little unintuitive.

Id highly suggest getting used to either ^ to go to the beginning of a line, or I (shift-i) to go to the beginning of the line and switch to insert mode.

  • For the record, they aren't Emacs shortcuts, they're much older and are present throughout the vast majority of unix systems, basically every terminal has them.
    – Lilly Cham
    Commented Feb 24, 2022 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .