danth / pathfinder.vim

Vim plugin to suggest better movements
MIT License
290 stars 4 forks source link

Moving down and up a line to move the cursor leftwards shouldn't be allowed #3

Closed danth closed 4 years ago

danth commented 4 years ago
xxCxxA
xxB

Given some text like the above, the script sometimes decides that the best route from A to C would be j to move the cursor down to B, then k to move it back up to C.

However, in reality Vim remembers the column the cursor was originally on, so moving back upwards ends up on A.

danth commented 4 years ago

This can be fixed by using winsaveview() to store cursor positions, in particular the curswant property.