Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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>
share|improve this answer
Perfect. Thanks :) – houbysoft Apr 26 '12 at 13:07
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. – Jack Jul 28 '15 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.