如何跳转到Vim中的确切最后一个更改点

Roc*_*cky 40 vim

'.可以跳到最后一次更改的行.但我需要跳到正确的位置.

小智 68

使用`..也就是说,反击后跟一个点.

  • 跳到上一版"插入"的确切点试试`gi` (9认同)
  • 要跳转到最后一次插入模式停止光标所在的位置,请使用`\`^`.使用`gi`在该位置启动插入模式.请注意,`\`^ i`与`gi`不完全相同(参见`:help gi`). (7认同)
  • 每天学习关于vi的新内容:-) (6认同)

lak*_*tak 5

因为改变有开​​始和结束,`[而且`]也非常有帮助:

'[  `[                  To the first character of the previously changed
                        or yanked text.

']  `]                  To the last character of the previously changed or
                        yanked text.

After executing an operator the Cursor is put at the beginning of the text
that was operated upon.  After a put command ("p" or "P") the cursor is
sometimes placed at the first inserted line and sometimes on the last inserted
character.  The four commands above put the cursor at either end.  Example:
After yanking 10 lines you want to go to the last one of them: "10Y']".  After
inserting several lines with the "p" command you want to jump to the lowest
inserted line: "p']".  This also works for text that has been inserted.
Run Code Online (Sandbox Code Playgroud)