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?


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>
| improve this answer | |
  • 2
    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.

| improve this answer | |

You must log in to answer this question.

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