Is there a way to set the cursor in normal mode to the end of the line? for example, |abcdefg to abcdefg| not abcdef|g

Cursor moves one character backwards on exiting insert mode


I looked up these but these threads don't give the solution to the problem but rather explaining how the default behavior of vim works.

Is there a way to move cursor at the end of the line just like how insert mode does with appending?

  • possible duplicate vi.stackexchange.com/questions/14451/…
    – Mass
    Commented Nov 9, 2022 at 2:16
  • For inserting text at the end, A is better than $a or g$i. If you can say more about why you want the cursor in that position, we can suggest better ideas.
    – D. Ben Knoble
    Commented Nov 9, 2022 at 22:33
  • thanks for the comment Ben. you're right, sorry for the inconvenience. as I use both vim/vscode I wanted the editors to look same to avoid the confusion, using a vertical bar rather than a block and locate the cursor at the beginning of the character in all modes rather than how vim originally behaves, and this resulted me to ask this question. for now, I'm happy with what Mass answered. using virtualedit=onemore, re-mapping $ to g$ and also i to a.
    – NoName
    Commented Nov 10, 2022 at 22:33

1 Answer 1


It is possible, but only if virtualedit=onemore or virtualedit=all.

If these options are enabled, then you can go to "one past the end of the line" using g$.

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.