Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim - Go to previous location

Tags:

vim

Say I open a file in vim. I start on line 1 column 1 and hold down j until I am on line 14. Pressing :7CR puts me on line 7. I press yy to "yank".

How do I return to line 14? Using CTRL + o takes me back to the top of the file. ` ` gives me the same results.

like image 736
deadghost Avatar asked Jun 13 '12 15:06

deadghost


1 Answers

You can type 7G to jump to line#7, then type Ctrl-o to jump back.
:set showcmd to show what you have typed at the right bottom.


To yank line#7 (No cursor moving):

:7y 

To paste line#7 below line#14:

:7t14 
like image 99
kev Avatar answered Sep 28 '22 06:09

kev