Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

Thanks!

share|improve this question

1 Answer 1

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.

See:

: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.

See:

: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

Your Answer

 
discard

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.