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

时间:2011-10-13 03:30:20

标签: vim

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

3 个答案:

答案 0 :(得分:66)

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

答案 1 :(得分:1)

由于更改有开头和结尾,`[`]也非常有用:

'[  `[                  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.

答案 2 :(得分:1)

我建议像现在这样映射到跳转到最后一个更改点:

gv ................... repeats last selection
gi ................... enters insert at the last inserting point

" gl to jump to the last change "exactly"
nnoremap gl `.        

参考:https://twitter.com/dotvimrc/status/191163723065462786