nvim-lua / wishlist

A public catalogue of Lua plugins Neovim users would like to see exist
MIT License
235 stars 0 forks source link

Plugin to visualise and navigate the undo tree #21

Open AckslD opened 3 years ago

AckslD commented 3 years ago

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

Why? See above.

Potential existing implementations: gundo.vim

*Potential pitfalls:*

bew commented 3 years ago

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

NOTE: it requires python

rodamaral commented 3 years ago

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.

talbergs commented 3 years ago

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

Julian commented 3 years ago

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

matu3ba commented 3 years ago

@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.

Julian commented 3 years ago

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 :)

HrvojeFER commented 2 years ago

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

matu3ba commented 2 years ago

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.

debugloop commented 1 year ago

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

bew commented 1 year ago

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!!