wishlist icon indicating copy to clipboard operation
wishlist copied to clipboard

Plugin to visualise and navigate the undo tree

Open AckslD opened this issue 3 years ago • 10 comments

What? A way to visualise and navigate the undo tree.

Why? See above.

Potential existing implementations: gundo.vim

Potential pitfalls:

AckslD avatar Jun 03 '21 08:06 AckslD

There is also vim-mundo (a fork of gundo) which I'm using.

NOTE: it requires python

bew avatar Jun 03 '21 10:06 bew

There is also vim-mundo (a fork of gundo) which I'm using.

and which is kinda slow, a Lua plugin is very welcome in this department.

rodamaral avatar Jun 03 '21 13:06 rodamaral

Also, vim-mundo asks for python (which I do not use).

talbergs avatar Aug 03 '21 19:08 talbergs

undotree sets the bar here IMO (and is what I use).

Julian avatar Aug 13 '21 21:08 Julian

@Julian @AckslD Do you happen to know about speed of undotree ? I am skeptical, if lua is necessary for applying the undohistory, since the main functionality is written inside neovim core.

So the plugin would only need to make visualisation and usability.

matu3ba avatar Aug 26 '21 17:08 matu3ba

In my experience the speed of undotree is fine.

(And I agree with the skepticism, I'm not a fan of rewriting or creating new Lua plugins just to say they're in Lua, they should also be better than the existing best, if only by being feature equivalent but being more maintainable not being vimscript. My point was just to share what I think the best current example is here :)

Julian avatar Aug 26 '21 17:08 Julian

It would be nice to have something like this as an extension to Telescope with a preview of changes.

HrvojeFER avatar Oct 29 '21 19:10 HrvojeFER

https://github.com/simnalamburt/vim-mundo has the awesome "search in undo history" feature, which I think is a must have of a lua rewrite (for perf reasons).

see also https://github.com/mbbill/undotree/issues/48 https://github.com/mbbill/undotree/tree/search

Unfortunately telescope has no "save search result state" to dump and load last state of the search window, which I feel would be a must have to search + navigate the search history on tracking down changes in multiple branches (traverse along the branch + keep searching in this branch etc).

The other thing I am not sure about, is if the visualization in telescope of the tree during search is simple enough to adjust.

matu3ba avatar Jul 18 '22 10:07 matu3ba

https://github.com/debugloop/telescope-undo.nvim I've written something that checks some of these boxes, take a look :)

debugloop avatar Dec 23 '22 16:12 debugloop

After reading this post: https://austinhenley.com/blog/yestercode.html I like the simple UI, and I'm starting to want something like this: keep the current code, but get a preview (in a split / float) of the state of my file X minutes/changes ago. The undo-tree plugins I tried usually show a diff preview of each change as we navigate, not the actual file as it was.

And to extend this, I've been thinking about having a kind of preview like this for the current line of code, or the current function.. Where the undo-tree is filtered to only show the changes that actually changes that line, function.. We'd need special care for the UI of such a filtered undo-tree, to avoid confusion though. And maybe prevent 'restore file to this change', unless we can also scope it to revert only the line, function,...?

I'm not sure how we could find all related change for a set of lines, to work for renamed functions/class/.., 'might' be possible by finding the change that did a rename, but it's not easy. But I think it would already be great without rename tracking!!

bew avatar Dec 23 '22 17:12 bew