I am new to Vim. My code file has 300 lines. Suppose currently the cursor is on line 254, and I used gg command the cursor turn to line 1. I want to go back to line 254 but I forget that line number. Is there a command the can do this?
Asked
Active
Viewed 5,524 times
9
muru
- 24,838
- 8
- 82
- 143
GoingMyWay
- 213
- 2
- 7
-
Strongly related question if not a duplicate. – statox Sep 19 '15 at 21:26
1 Answers
17
Use `` to jump back to the exact position you were in before you searched/jumped, or '' to jump back to the start of the line you were on before you searched/jumped.
You can also use CTRL+O and CTRL+I for jumping back and forward.
See also:
Simone Carletti
- 1,210
- 1
- 10
- 9
-
1See also
:help '',:help 03.10,:help jump-motionsand:help motion.txt. – garyjohn Sep 19 '15 at 14:49 -
1One really powerful thing about Ctrl+O and Ctrl+I is that it will even jump between files! – Hovercouch Sep 20 '15 at 18:36