3

I just accidentally did f], how do I return the cursor to where it previously was?

Ctrl-O doesn't work of course because f is not regarded as a jump.

, doesn't work because I wasn't on a ] previously.

1
  • I do believe you can remap it, and save the lastpos register to allow for ctrlO. I don't know if recommended.
    – eyal karni
    Commented Dec 8, 2020 at 12:21

2 Answers 2

2

You can't.

But f only works in the current line, so you must be near anyway. This also true in general: if motion doesn't appear in the jumplist then it is probably an intra-line motion.

2
  • "you must be near anyway" so what's the fastest most brainless way I can make it back?
    – minseong
    Commented Dec 7, 2020 at 23:23
  • 3
    @theonlygusti bbbb...
    – Matt
    Commented Dec 8, 2020 at 5:54
1

Use the plugin Houl/repmo, to extend these abilities by providing pairs of forward and reversed(backward) motions. Like [s, ]s. It usually overrides the normal keys for repeating motion ;, ,.

Notice that you can't exactly undo f], but it does F], which mostly is good enough. It is better in the example I gave (next/prev spelling error).

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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