mbbill / undotree

The undo history visualizer for VIM
http://www.vim.org/scripts/script.php?script_id=4177
BSD 3-Clause "New" or "Revised" License
3.97k stars 101 forks source link

Feature request: UndotreeClear command to clear out undo history #158

Closed lukelbd closed 9 months ago

lukelbd commented 1 year ago

Sometimes I have vim sessions open for an extremely long time, and it might help speed things up if I could clear both vim's undo history and the undo tree cache vimscript dictionary (which I am guessing stores the tree structure / is the part that goes beyond vim's capabiilties?).

It would be nice to be able to do this with a command that clears the undo history and resets the undo tree, without having to go into the pane and pressing a shortcut.

Perhaps it could be defined command -bang -nargs=0 :UndotreeClear call undotree#UndotreeClear(<bang>0) , so that typing :UndotreeClear resets the tree after issuing a confirmation prompt (like pressing C) and :UndotreeClear! does so without any user confirmation (<bang>0 would expand to 0 or !0 == 1 in each case; this would pass an UndotreeClear() function parameter called e.g. a:force that determines whether user confirmation is bypassed).

lukelbd commented 1 year ago

I might try a PR sometime later this summer.

lukelbd commented 9 months ago

Originally I thought undotree was causing was causing these slowdowns but I tracked it to other things in .vimrc. I'll close for now, if anyone else is interested feel free to give a try