0

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!

1 Answer 1

5

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

2
  • That worked! Any help regarding the Alt+right arrow thing? Dec 7, 2012 at 23:45
  • Yes. Answer edited.
    – Heptite
    Dec 8, 2012 at 4:02

You must log in to answer this question.

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