Sublime Forum

Undo Tree Implementation and Visualization

#1

I just switched from VIM to sublime text 2. I LOVED my vim, but st2 is a great editor too. I think the only MUST HAVE missing feature is the undo tree, and a way to visualize/manipulate the tree. Something like this: sjl.bitbucket.org/gundo.vim/

0 Likes

#2

bump!

0 Likes

#3

bump!

0 Likes

#4

you could do it as a plugin by overriding the undo/redo commands (via on_text_command—“Called when a text command is issued. The listener may return a (command, arguments) tuple to rewrite the command, or None to run the command unmodified.”) and having an own stack/tree. then your plugin can of course also visualize this tree

0 Likes

#5

You bring up a great point here.

Hopefully soon someone will implement “Gundo for ST”. I hope it won’t be me, but if this goes on for another year it might actually be me.

0 Likes

#6

I’ve messed around with hooking the undo command and utilizing view.command_history before and my experiences weren’t too great. I honestly would prefer this to be implemented as a core feature.

0 Likes

#7

Me as well! This is such an excellent feature I would be willing to “chip in” to pay someone to make a high quality extension like Gundo!

0 Likes

#8

In light of the forum refresh, heres a bump!

0 Likes

#9

heres another one!!

0 Likes

#10

and yet another!

@unphased It just might have to be you! :grin:

0 Likes

#11

I don’t use sublime anymore. It’s all about Vim!

0 Likes

#12

Another bump!

0 Likes

#13

Another bump!

0 Likes

#14

Another one!

0 Likes

#15

And another!

0 Likes

#16

Update: The bitbucket site seems to be down.

A mirror can be found on: https://github.com/sjl/gundo.vim

and a Screenr: http://www.screenr.com/M9l

0 Likes

#17

Another bump!

@valerij_ I re-read your recommendation. Do you know of any plugins that do something similar that could be used a starting point?

(Note: My strategy from now on is to bump every time I need this feature in real life, with a minimum bump-interval of two weeks)

0 Likes

#18

@diego898 I doubt this is coming any time soon because of quite little return on investment. The feature being requested is quite complicated and there isn’t exactly a big demand for it.

You could try working on a plugin to do this, though. You could make use of Vcs to handle multiple branches etc.

0 Likes

#19

not really.

per se, this wont be that much of a hassle, just create a tree structure, have an (git like) HEAD where you append new states. The only thing i dont really know is how to hook existing functionality which pushes states to the undo stack, but i guess one could just hook all edit events and push that. The developer of Braid had a good talk about how to have a lot of undo information while not utilizing a ton of memory, those ideas would be useful here.

as for visualization, i would copy the code from git to layout and draw the tree in ascii.

as @FichteFoll said, you could even try using a in-memory VCS, maybe dulwich can be hacked that way

0 Likes

#20

Just a note here that such a package has been developed and added to Package Control:

https://packagecontrol.io/packages/Sublundo

4 Likes

Sublundo: Vim-like persistent, branching undo