How can one move vertically, staying in the same column (implicitly adding spaces), regardless of line lengths? (If the next line is shorter than the current, j will move the cursor to the last character of the next line.) This would be useful when adding comments.

  • 2
    Maybe set virtualedit=all (but read about it first: :h virtualedit)
    – VanLaser
    Sep 11, 2015 at 12:33

1 Answer 1


You can consider set ve=insert if you just want to do virtual edit in insert mode.

set ve=all if you want to do virtual editing in all modes. This may break some macro or plugin (if the plugin doesn't check the ve option).

:h 've' to know more about virtualedit option.

You can add a mapping, easily setting the ve option to all and back for your requirements, just like toggling line numbers.

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.