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.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI 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.
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.
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).