0

I'm looking for a command similar to g;, but that ignores changes that are close to the cursor (say, less than 5 lines away).

When I'm editing some function in the middle of a file, I sometimes need to jump away to make a few changes, potentially entering insert mode several times in the process (for instance, editing Python imports or some constants at the top of the file). When I'm ready to go back to the function I was working on, I need to press g; several times until I'm back to where I began. I can't prefix the command with a number, since I didn't count how many times I entered insert mode.

Is there a single command that 1) doesn't require me to explicitly set a mark before jumping 2) can bring me back to before I jumped?

2
  • 2
    Ah, I was wrong, it might be possible to script something around getchangelist() Jul 6 at 11:10
  • My workflow often involves :split/C-w s to edit imports at the top; then I can close it and be back where I was
    – D. Ben Knoble
    Jul 6 at 13:55

Your Answer

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

Browse other questions tagged or ask your own question.