Hubro
Hubro

Reputation: 59388

Vim: Why can't I map to the <j> key?

I saw this key bind in tips.txt:

:map <C-U> <C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y>

Which results in smooth scrolling up for CTRL-U. It only moves the viewport though, and I'd like to also move the cursor, so for scrolling down I tried:

:map <C-D> <C-E><j><C-E><j><C-E><j><C-E><j><C-E><j><C-E><j><C-E><j><C-E><j>

Since CTRL-E moves the viewport down and j moved the cursor down. This doesn't work however. When I press CTRL-D the viewport just hops one line down and the terminal beeps.

How do I map CTRL+D to scroll and move the cursor?

Upvotes: 1

Views: 206

Answers (1)

user849425
user849425

Reputation:

You shouldn't have the angled brackets (</>) around j.

Upvotes: 4

Related Questions