Live data from Hacker News

Resolving the great undo-redo quandary

github.com

161–170 of 247 posts

Re: Resolving the great undo-redo quandary

#161
post #153
post #102

Vim has this, it's :earlier and :later https://vimtricks.com/p/vimtrick-time-travel-in-vim/ :earlier 3 – Undo the last 3 changes :earlier 5m – Go back to the state of the file 5 minutes ago :later 2 – After undoing something, redo the next 2 changes :later 1h – Travel forward through the change history 1 hour Vim also stores the tree of changes, but it's a pain to access without plugins.

Wait until you see what intellij can do. It can do that, while also layering it in a logical, graphical diff viewer

I don’t doubt that IntelliJ overall is more user-friendly. But just to note, Emacs’ undo-tree can also show the diff for each change.

Edit: Screenshot (with an unusually blue Emacs theme): https://www.emacswiki.org/emacs/UndoTree#h5o-5

Re: Resolving the great undo-redo quandary

#162

This is exactly how undo works in Emacs out of the box. Personally, I prefer to install the undo-tree package and manually browse through the tree of undo paths. I'm not sure why this author finds a tree unacceptable for this purpose.

Additionally, emacs will filter undo/redo’s to changes within a region. If you select a region (no new command to learn) and use undo/redo, it will only perform those that affect text completely within the region. This is a superpower that delights me each time use it.

Do you know a way to keep the region selected after undoing so as to continually undo within the region?

Re: Resolving the great undo-redo quandary

#164
Google's internal source repository client CitC (client in the cloud) behaves this way for your entire workspace, forever.

It was so freeing - every single file save, delete, move and so on was saved without user intervention.

Realize that you were barking up the wrong tree for 2 days? Simply go into .snapshots and the entire workspace from before would be there.

This interface composed so well with other tools you could do a parallel bisection test across every prior state of your workspace and find the minute where you made an edit that broke some functionality. All on the cloud.

I miss this tool very much. No amount of git commit discipline can emulate it.

Re: Resolving the great undo-redo quandary

#165
post #153
post #102

Vim has this, it's :earlier and :later https://vimtricks.com/p/vimtrick-time-travel-in-vim/ :earlier 3 – Undo the last 3 changes :earlier 5m – Go back to the state of the file 5 minutes ago :later 2 – After undoing something, redo the next 2 changes :later 1h – Travel forward through the change history 1 hour Vim also stores the tree of changes, but it's a pain to access without plugins.

Wait until you see what intellij can do. It can do that, while also layering it in a logical, graphical diff viewer

Vim has plugins for that. ;)

I use https://github.com/mbbill/undotree but if that's not to your taste there are many others.

e.g. https://docs.stevelosh.com/gundo.vim/

Re: Resolving the great undo-redo quandary

#166

Earlier quoted context omitted.

Use local history in any JetBrains IDE.

I am not a JetBrains user, but it looks like that only applies to saved versions? Undo normally holds every typed change. https://www.jetbrains.com/help/idea/local-history.html#resto...

You’re usually autosaving. So it’s not every character, but maybe every minute and lots of other logical triggers like running the file. I’ve found it works very well.

Re: Resolving the great undo-redo quandary

#167

Earlier quoted context omitted.

I have started to learn Vim about a year ago and still learning new tricks each day

Wait until you say this after 10 years.

After 10 years he might even be as fast as with a non-modal editor.

Re: Resolving the great undo-redo quandary

#168
post #26

This is exactly how undo works in Emacs out of the box. Personally, I prefer to install the undo-tree package and manually browse through the tree of undo paths. I'm not sure why this author finds a tree unacceptable for this purpose.

And it is exactly why I find Emacs undo so hard to work with. But maybe I will get it now I've read this article.

Two suggestions that might make it easier for you. There's a package called `undo-fu` that puts a thin layer on top of the undo system to keep the behavior strictly linear.

And built in, there are the `undo-only` and `undo-redo` commands. Unlike the base `undo` they will only walk in one direction.

Re: Resolving the great undo-redo quandary

#169
post #165
post #153

Earlier quoted context omitted.

Wait until you see what intellij can do. It can do that, while also layering it in a logical, graphical diff viewer

Vim has plugins for that. ;) I use https://github.com/mbbill/undotree but if that's not to your taste there are many others. e.g. https://docs.stevelosh.com/gundo.vim/

F** right off. How have I used Vim for fifteen years and not learned about this.

Re: Resolving the great undo-redo quandary

#170
post #165

Earlier quoted context omitted.

Vim has plugins for that. ;) I use https://github.com/mbbill/undotree but if that's not to your taste there are many others. e.g. https://docs.stevelosh.com/gundo.vim/

F** right off. How have I used Vim for fifteen years and not learned about this.

Haha, that made me spit my drink. :D
Post reply on HN