This question looks like How to keep cursor horizontal position while scrolling in VIM? but it's actually not.

Vim always tries to snap the cursor to the first non-whitespace character of the destination line while scrolling.

Consider this text:

    Line 2

Now the cursor points to 'A', when I press <C-d> to scroll a half page, Vim will automatically snap the cursor to 'L' in the second line.

What I want is to remain the horizontal position of cursor unless I explicitly command Vim to do so (like 'h', 'l').

1 Answer 1


The option you want is 'startofline'. Specifically, you want to turn it off since it is on by default:

:set nostartofline


:help 'startofline'

(with the single quotes as part of the help command)

You must log in to answer this question.

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