T_T
T_T

Reputation: 1280

Jump from the beginning of a line to the end of the line above

I want to know what is required in .vimrc to achieve the following.

Consider the following situation:

Line 1 -> ABC DEF GHI

Line 2 -> JKL MNK OPQ

where A and J are both the beginning of each line, and I and Q are the end of those lines, respectively.

Case (1) Suppose that the cursor is in J. In order to move from J to I, I have to press a key k and a key $ in my current setting. I want to configure MacVim so that pressing a key h brings the cursor to I.

Case (2) Suppose that the cursor is in I. In order to move from I to J, I have to press a key j and a key 0 in my current setting. I want to configure MacVim so that pressing a key l ("el") brings the cursor to J.

Can anyone help?

Upvotes: 2

Views: 70

Answers (2)

Ingo Karkat
Ingo Karkat

Reputation: 172520

You're looking for

:set whichwrap+=h,l

(But its help says this setting is not recommended, probably because it's against the original vi behavior and might break some macros and plugins.)

Upvotes: 3

Kent
Kent

Reputation: 195039

case(1): cursor J -> I :

press ge or gE

case(2): cursor I -> J :

press w or W

Upvotes: 4

Related Questions