4

On nano&emacs&any other text editor, when the cursor is at the 1st character of a line (not the 1st line), press the left key and it will automatically jump to the last character of previous line.

Similarly, press the right key when cursor is at end of a line,and it will automatically jump to the 1st character of next line.

How to make this work on vim(normal, insert and visual mode)?

1 Answer 1

5

The option is called :h 'whichwrap' (or ww for short). For example,

set ww+=<,>,[,]

However, "right arrow" only goes onto the next line if you don't have set virtualedit=all (that you normally do). In the latter case a line never "ends" and the cursor keeps moving to the right until you press j or <CR> etc.

2
  • Thank you for your option, but still not working with insert mode, is there any solution?
    – HaraInanba
    Commented Feb 24, 2021 at 8:57
  • @HaraInanba It must work unless your terminal don't have arrows working at all.
    – Matt
    Commented Feb 24, 2021 at 8:59

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.