News for hackers. Stuff that matters.
Re:Why is it so hard to see code from 5 minutes ago? by craigds on Friday February 19, 2021 @01:21AM (#26190317)
In Sublime Text I actually use a quick Undo-then-Redo to navigate, of all things.

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)

Re:Why is it so hard to see code from 5 minutes ago? by teddyh on Friday February 19, 2021 @02:53AM (#26190681)
> Now I have to get back to where I was.

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.

Re:Why is it so hard to see code from 5 minutes ago? by zegl on Friday February 19, 2021 @02:57AM (#26190699)
Funny, I've been using the same trick in VSCode without reflecting on it.
Re:Why is it so hard to see code from 5 minutes ago? by Resinderate on Friday February 19, 2021 @12:21PM (#26195379)
I do a similar thing, but I use "soft_undo" as it seems to include navigation jumps in it's stack so it's only one step. Think the default keybind is Cmd+U.
Re:Why is it so hard to see code from 5 minutes ago? by wodenokoto on Friday February 19, 2021 @01:43AM (#26190411)
There is a navigational back command, that moves your cursor back in time, just like a webbrowsers back button.

cmd+-, if I remember correctly.

Re:Why is it so hard to see code from 5 minutes ago? by caillou on Friday February 19, 2021 @06:14AM (#26191855)
`ctrl + -` is a good short-cut.

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.

Re:Why is it so hard to see code from 5 minutes ago? by wodenokoto on Friday February 19, 2021 @09:27AM (#26193469)
What ever works for you. To return to scroll position I click up then down or left then right.

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.