How to jump to the exact last change point in Vim

Vim

Vim Problem Overview


'. can jump to the line of last change. But I need to jump to the exactly point.

Vim Solutions


Solution 1 - Vim

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

Solution 2 - Vim

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.

Solution 3 - Vim

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRockyView Question on Stackoverflow
Solution 1 - VimLifu TangView Answer on Stackoverflow
Solution 2 - VimlaktakView Answer on Stackoverflow
Solution 3 - VimSergioAraujoView Answer on Stackoverflow