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?

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.)
  • 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 at 14:01
  • 1
    I just used <code> tags. I tried <code>`[</code> 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. – theonlygusti Jul 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 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.