VI Editor: Move to EOL instead of last character

前端 未结 2 1957
Happy的楠姐
Happy的楠姐 2021-02-03 12:10

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

2条回答
  •  死守一世寂寞
    2021-02-03 12:17

    The normal mode command for entering insert mode at the end of the line is A.

    More generally, i enters insert mode before the current character so what you get is perfectly in line with what you do: $ puts the cursor on the last character and i enters insert mode before the last character. That's what you ask Vim to do and that's what it does.

    If you want to enter insert mode after the current character, the right command is a so what you should have done instead of $i (which can't do what you want, whether you are in vi or vim) is $a for which there is a cool shortcut: A.

提交回复
热议问题