<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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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