开发者

How to jump to the exact last change point in Vim

开发者 https://www.devze.com 2023-04-13 03:53 出处:网络
开发者_如何学编程\'. can jump to the line of last change. But I need to jump to the exactly point.Use `..That is, backtick followed by a dot.As a change has a beginning and an end, `[ and `] are also

开发者_如何学编程'. can jump to the line of last change. But I need to jump to the exactly point.


Use `.. That is, backtick followed by a dot.


As a change has a beginning and an end, `[ and `] are also very helpful:

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


answers are kinda old, but for current reference:

:changes show a list of changes
g; jump to last edit
g, jump forward in last edit's

found at vimtricks


I suggest a mapping to jump to the last changing point, as we have:

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

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

Reference: https://twitter.com/dotvimrc/status/191163723065462786

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号