I'm most often finding myself having to work with plain old vi on minimalistic terminals that tend to act differently than the vim on big distros, and so the behavior trips me up.
What I want to know is not how to move to the last character in the line, but one character past that. Because typing $
does NOT move the insertion cursor to the last character in the line, and this is easily proven. I'm using vi on MSYS right now.
If I type in the line
This is a test
and hit esc
, $
, i
, and <enter>
, I will get the following:
This is a tes
t
This shows that the insertion cursor was not put at the end of the line, but one to the left of the last character in the line (Imagine the box being a line like in Notepad++. The box is over the top of the letter, signifying that the character will be inserted in the area that makes up the box's left side), and I know this because if it were really at the end ("end" meaning to the RIGHT of the last character) the last character would not be moved to its own line such as what you see above.
I don't want this behavior. It's too much a pain for me to type one extra character every time I press enter just to ensure I don't have to retype my words. This kills my productivity.
How do I fix this? Is it a setting I can tweak in .exrc
?
i
it inserts before the character you are on. Usea
to insert after (append), andA
to append at the end of the current line ("after"$
). – FrazzledA
in command mode? That should put you after the last character in insertion mode. If that doesn't work type<Esc>$a
which should do the same thing. – Binghii
anda
put you in insertion mode, the difference is thati
starts you before the current character anda
starts you after. – Binghi