When we are in insert mode in vim:
foo b[a]r
Where []
denotes cursor position
And we go back to normal mode, cursor is going one position left:
foo [b]ar
Is there advantage of this?
Your initial "state" is wrong, this is what you get in insert mode:
bar[]
In insert mode, the cursor is between characters while it is on a character in normal mode. When you leave insert mode, the cursor has to be on a character: what character could it be? The one on the left of the insert mode cursor or the one on the right? How is Vim supposed to decide which side is the good one?
One hint would be the command used to enter insert mode: leaving insert mode after i
could probably leave the cursor on the left side and a
could probably leave it on the right side. But, what would be the point of having the cursor on the character that's on the right of the last character we typed?
Anyway, insert mode is for inserting text exclusively. i<Esc>
or a<Esc>
make no sense and serve no practical purpose. On the other hand:
Lorem[] dolor sit amet.
Lorem ipsum[] dolor sit amet.
<Esc>
Lorem ipsu[m] dolor sit amet.
makes a lot more sense than:
Lorem[] dolor sit amet.
Lorem ipsum[] dolor sit amet.
<Esc>
Lorem ipsum[ ]dolor sit amet.
Doesn't it?
I don't see a direct advantage over just typing h
.
The observed movement to the left is a side product of a convention in VIM - always leave insert mode "to the left" - which I find very convenient.
Convenient, because there are many ways to enter insert mode and, having done some insertions, I care about how to exit rather how I have entered insert mode.
There are ways to change this behavior, cf. these SE posts:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With