Thomson
Thomson

Reputation: 21625

Return focus to the last position in editing in Vim?

Is there a Vim command which could returns the focus to the position be just edited? This is very useful after some code searching for edit.

Upvotes: 2

Views: 657

Answers (2)

Kent
Kent

Reputation: 195059

I usually do g;, jump back to the last changed position.

Note that, g; will go to the last position in change list, that is, no matter your change was done in insert or normal mode, once it was in your change list, g; is gonna bring you there.

You can keep pressing g; to navigate your change list.

g, is for opposite direction.

Upvotes: 6

kev
kev

Reputation: 161674

gi - Insert text in the same position as where Insert mode was stopped last time in the current buffer.

`^ or '^ - Jump to the position where the cursor was the last time when Insert mode was stopped.

`. or '. - Jump to the position where the last change was made.

Upvotes: 4

Related Questions