by craigds · 5y ago · 0 comments
I'll be typing some code and realise I need to check whether the imports at the top of the file are correct.
So I'll Cmd+Up (go to the top of the file) and see that yes, they are correct. Now I have to get back to where I was.
A quick Cmd+Z,Cmd+Shift+Z does the trick - Undo (takes me back to the code I was editing, and undoes some of it) and Redo to put it back to how it was. Works well, but would mess up this researcher's statistics.
(I absolutely do also use the undo stack for looking at the last few minutes of history too, that's really valuable)
In Emacs, you can often use C-x C-x for this, since many movement commands which moves far away, like beginning-of-buffer, sets the mark at where you moved from. So C-x C-x moves you back. If this does not help, i.e. you have moved several times, you can almost always get back by repeatedly doing C-u C-Space until you find yourself at the correct place again.
cmd+-, if I remember correctly.
But, often times I have jumped around many times, or only scrolled. It doesn't work in these situations. Whereas `undo` `redo` reliably brings me back to the place of last input.
You can use `ctr + -` to also jump between documents. So if you’ve jumped to a function definition in another document the back shortcut can take you there.