<c-d> and <c-u> both, by default, drop you in the first non-whitespace column of the given row.

This behavior is kind of distracting when quickly scanning through pages. Is there a way to get way to configure vim to keep the cursor in the same column when scrolling by pages. I have virtualedit enabled, so not-moving the cursor is always possible, even if <c-u>/<c-d> moves focus to an empty line.

  • 1
    I don't think you can do this Commented Dec 5, 2017 at 7:11

2 Answers 2


In addition to setting virtualedit=all,

:set nostartofline

The relevant option is startofline.

set nostartofline will prevent vim from moving to just after leading indentation after performing a motion like c-u, c-d, gg, G.

I can confirm that it interacts in the expected way (not moving the column) when virtualedit is enabled.

  • Thank you, this is exactly what I needed.
    – Jim
    Commented Jan 5, 2023 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.