Sometimes we are editing a certain section of code in vi and then navigate to different section for reference. It is tedious to come back to the section we are editing. Here is a quick trick to come back to same section we were editing earlier.
-
First undo the last change (temporarily). This will bring us to the section we did the last edit.
[ESC] + u
-
Now redo the last undo. This will bring back to original state of the file. but the vi cursor is at the last edited locaiton.
[ESC] + [CTR] + r