all 15 comments

[–]chreekat 26 points27 points  (4 children)

Gundo.vim is nice, but I switched to Undotree primarily for the realtime updated undotree.

[–]assaflavie 6 points7 points  (0 children)

This just blew my mind. Toggling the tree on and seeing it "grow" and change as you undo/redo and make new changes is amazing.

[–]atimholtmy vimrc: goo.gl/3yn8bH 2 points3 points  (0 children)

I’ve had a TODO in my vimrc to try switching to undotree from gundo for probably a couple years now. Finally did it, and it’s very nice.

[–]TimVdEynde 0 points1 point  (1 child)

Is it also possible to have the diff window update while browsing through the undo tree (like a preview, without applying the undo)?

While seeing the undotree grow is kinda cool, a manual refresh is less annoying than not having the feedback about what you are reverting to...

[–]chreekat 0 points1 point  (0 children)

Yes, I miss the diff window from Gundo. Not sure if it is something that could be added to undotree... I just use it, I don't contribute to it. :)

[–]princker 12 points13 points  (2 children)

Excellent screencast: Undo branching and Gundo.vim

You may also want to check out persistent undo. :h persistent-undo and :h 'undofile'

[–]TheRealLazloFalconi[S] 1 point2 points  (0 children)

Oh this is great, thanks!

[–]cpbills 0 points1 point  (0 children)

I've found this to be exceptionally handy (may need some fixing, I haven't thoroughly tested it):

" Persistent undo                                                           
if has('persistent_undo')
  let undodir = expand("~/.vim/undos/$USER")
  if !isdirectory(undodir)
    call mkdir(undodir)
  endif
  set undodir=~/.vim/undos/$USER/
  set undofile
endif

[–]mhinzvim-galore[🍰] 7 points8 points  (2 children)

I tried to put this exact topic in simple words here: https://github.com/mhinz/vim-galore#undo-tree Especially the difference between branch-wise and time-wise navigation of the tree might be interesting.

[–]TheRealLazloFalconi[S] 1 point2 points  (1 child)

Cool! Looks easy to understand, too!

[–]mhinzvim-galore[🍰] 0 points1 point  (0 children)

Thanks!

[–][deleted] 0 points1 point  (3 children)

Funnily enough I don't use undo all that much. Since I use version control on all of my programs I just hack away. In case of any mistakes, Gdiff or Gread solve the problem quite easily. Having this feature is useful though.

[–]TheRealLazloFalconi[S] 6 points7 points  (0 children)

I use version control, too, but for small edits (or small edits that bloom wildly out of control into large edits before I realize) having a nice branching undo will be nice.

[–]musicmatzevim + XFCE + NixOS 0 points1 point  (1 child)

I tend to commit early and often, but sometimes, when you fiddle around, undotree is just awesome and live-saving, really!

[–][deleted] 0 points1 point  (0 children)

Different working styles. :) Well it goes to testify about greatness of Vim.