Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 want to map e to mean end of line.

I tried the following mapping in my vimrc:

map $ e

$ is the default end of line command. However, this doesn't work. I'm wondering what the problem is.

Also, I want to map Alt+right/left arrow to navigate words. So, for example, Alt+right arrow would take me to end of word. This command is currently mapped to e.

Any tips on how I would go about doing this?


share|improve this question
up vote 5 down vote accepted

You have your mapping reversed, it should be:

:map e $

But I suggest you use :nnoremap instead:

:nnoremap e $

The problem is that "e" is already an important movement command and changing its behavior is almost certainly going to cause you trouble in the future, especially if you decide to install any plugins that need to control cursor movement.


:help :nnoremap
:help e

To answer the second part of your question, you would want to nnoremap "<M-Right>" and "<M-Left>" to w/e and b respectively.


:help key-notation

(The information on modifier prefixes is near the bottom of the table in that help entry.)

share|improve this answer
That worked! Any help regarding the Alt+right arrow thing? – efficiencyIsBliss Dec 7 '12 at 23:45
Yes. Answer edited. – Heptite Dec 8 '12 at 4:02

You must log in to answer this question.

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