Gio
Gio

Reputation: 3340

Vim jumps to last occurence of replacement argument

When I execute a replace command, e.g

:%s/toBeReplaced/Replacement/g

Vim jumps to the last occurence of toBeReplaced. This is quite irritating because I have to go back to the position where I was editing. I've quikly renamed my .vimrc to .vimrc_ in order to disable my personal .vimrc. The same thing happens, hence it seems to be vim's default behavior.

When a replacement command is executed, I want vim to stick at the position where I am editing at that moment. Is there any way to achieve this??

Upvotes: 2

Views: 46

Answers (1)

Kent
Kent

Reputation: 195209

after you executed the :s, press :

``

will bring you back to the position before your run the cmd.

Upvotes: 8

Related Questions