2

`. seems to take me to where I last left insert mode, but I would like to jump to where my cursor was when I entered insert mode last.

How can I do that?

minseong
  • 2,313
  • 1
  • 19
  • 38

1 Answers1

4

If you haven't yanked or changed text since your last insertion, then you can use the `[ mark (see docs), which gets you back "to the first character of the previously changed or yanked text."

By the way, `. will track your last change, not necessarily an insertion, a deletion, indent or format operation would also reset this mark.

The `^ mark is the one tracking your last insertion. (But, as you mentioned, it will go back to where your cursor ended, not started.)

See also:

  • :changes, which shows you a list of recent changes, including insertions;
  • the g; command, which lets you jump back to previous positions in that list (and corresponding g, to jump forward.)
filbranden
  • 28,785
  • 3
  • 26
  • 71
  • 3
    This was probably the hardest markdown I ever had to type, given the number of `s (couldn't have more than one on the same line) and [ is special too... Phew! – filbranden Jul 19 '19 at 14:01
  • 1
    I just used <code> tags. I tried `[ earlier but it didn't work for me, i guess I'd accidentally made an additional change in-between bc it is actually what I want. – minseong Jul 19 '19 at 20:33
  • @theonlygusti If you have another ` on the same line, that will confuse it... Preview window was terribly helpful here! – filbranden Jul 19 '19 at 20:36