How to go back to origin file after jump to a definition file?

In the source, if we want to jump to a definition file by a function name, we can press gd on the word. Then it change to the new file.

Is there a key set to go back to the previous file(or buffer)? Not SPC b b.

C-o (better-jumper-jump-backward) will take you to your previous location (also works after pressing gg for example). To go forward, C-i (better-jumper-jump-forward).

You can also use SPC-, to check the buffer list and the top entry should be your most recently visited buffer.


Yep, C-o is your friend when jumping between files or inside the same file

You can also use M-, (better-jumper-jump-backward in Doom, xref-go-back in vanilla Emacs). Highly recommend it if you find the Alt key is easier to hold than Ctrl (like I do).

Thank you very much. Where did you get the commands? Is there an official list or document for them?

I learned about C-o + C-i after googling a similar question when I was using neovim. Evil’s vi emulation is so good that if something works in vim, it’ll almost always work in Emacs too.

It seems there isn’t a detailed document for the short keys.

Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.