sponsor Vim development Vim logo Vim Book Ad

histwin.vim : Browse the undo tree

 script karma  Rating 213/74, Downloaded by 7560  Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
 
script type
utility
 
description
PLEASE RATE THIS PLUGIN, IF YOU LIKE IT!

Feedback is always welcome. See :h histwin-feedback.

You can now follow development of this plugin via github: http://github.com/chrisbra/histwin.vim

Vim 7 has an amazing feature that is called undo-branches. See :h undo-tree. Unfortunalley it is a little bit clumsy to use.

Therefore this plugin allows for easy navigation between the different undo-branches for a file.
See this screenshot: http://www.256bit.org/~chrisbra/vim_undotree.png
This plugin was inspired by the undo_branches plugin (http://www.vim.org/scripts/script.php?script_id=1997).

This plugin allows you to
- see all available undo-branches (Timestamps and Keywords)
- tag certain states
- switching to different states (including the first state (before any changes were made)
- allow to diff the selected undo-branch with the current version
- replay the changes (ok, this is just for fun ;)

Open the UndoBrowse window by issuing :UB
A new window will appear, which contains the name of the file you are watching a small help
banner that contains the most important mappings for this window and a list of all available
undo-branches (which shows the time when this change was made and your tags for that state, if there are any). On each entry you can press Enter or T to jump to that state or tag that state.

This plugin maps the following keys:
- 'Enter' on an entry jump to that state in time of the file
- 'T' tags a state with a phrase.
- 'R' lets you replay a change
- 'I' opens/closes the help banner
- 'Q' closes the window
- CTRL-L reload view
- D diff selected version
 
install details
edit the file histwin.vba with vim. From within vim simply load this file:
:so %

Vim will automatically install this plugin.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
histwin-0.24.vba 24 2013-02-16 7.3 Christian Brabandt - prevent loading of autoload script too early (reported by Sergey Khorev, thanks!)
- apply &fenc setting before writing file for diff (patch by Ben Fritz, thanks!)
(automatically uploaded)
histwin-0.25.vba 25 2011-08-15 7.3 Christian Brabandt fix issue 2 from github https://github.com/chrisbra/histwin/issues/2
(When
'splitright' is set, Diffing a previous undo branch separates the window layout, reported by bootleq, thanks!)
(automatically uploaded)
histwin-0.24.vba 24 2011-08-02 7.3 Christian Brabandt :ID is already defined by the visincr plugin, instead use the command :HistID, also a wrong error message is fixed
(automatically uploaded)
histwin-0.23.vba 23 2011-07-30 7.3 Christian Brabandt Purge Undo history with "X"
(automatically uploaded)
histwin-0.22.vba 22 2011-07-27 7.3 Christian Brabandt - Display signs for changed lines
- |:ID|
- small code improvements
(automatically uploaded)
histwin-0.21.vba 21 2010-12-18 7.3 Christian Brabandt - more standard like help files
- make sure, the autoload script is only called when needed
  (and not on startup)
histwin-0.20.vba 20 2010-10-20 7.3 Christian Brabandt -Enable storing the tags as Dicionary in .viminfo
  (this might not work as expected, cause we are storing a nested
  Dictionary)
- Show a diff in the preview window when pressing P (or on autocommand
  CursorHold if enabled)
- a little bit code cleanup (as always ;))
- correctly catch E830 and give an error message (reported by D.
  Fishburn)
(automatically uploaded)
histwin-0.19.vba 19 2010-10-18 7.3 Christian Brabandt Make sure the first entry will be tagged 'Start Editing'
histwin-0.18.vba 18 2010-10-16 7.3 Christian Brabandt don't leave the buffer in nomodifiable state (reported by D. Doran)
histwin-0.17.vba 17 2010-10-10 7.3 Christian Brabandt the initial entry should be visible for Vim < 7.3.005
histwin-0.16.vba 16 2010-10-10 7.3 Christian Brabandt -more bugfixing. :UB throws errors in Vim before 7.3.005 fix that
histwin-0.15.vba 15 2010-10-07 7.3 Christian Brabandt Fixed bug when no undo-tree was available (partly by Ben Boeckel. Thanks!)
-More error handling (when the cursor is not on a list item)
-Commenting out the entry to store the histdict in a global variable, that should be written to the .viminfo file (but is not yet supported by plain vim)
histwin-0.14.vba 14 2010-09-29 7.3 Christian Brabandt (experimental version):
- don't fix the width of the histwin window
- now use the undotree() function by default (if patch 7.3.005 is
  included)
- display save states in the detailed view
- display the 'rehash' when a state is not accessible anymore
- fixed an annoying bug, that when jumping to a particular undo state,
  the plugin would jump to the wrong state (I hate octal mode)
- Make displaying the time much more reliable and also don't display
  the time, if the change happened more than 24h ago (instead, display
  the date, when this change was done).
- slightly improved error handling.
- prepare plugin, to permantly store the undotags in the viminfo file
  (this isn't supported by a plain vanilla vim and requires a patch)
- A major rewrite (code cleanup, better documentation)
histwin-0.13.vba 0.13 2010-08-31 7.2 Christian Brabandt - New version that uses Vim 7.3 persistent undo features |new-persistent-undo|
- Display saved counter in detailed view
- Display indicator for saved branches.
- in diff mode, don't set the original buffer to be nomodifiable (so you can always merge chunks).
- Check for Vim Version 7.3 (the plugin won't work with older versions of Vim)
histwin-0.12.vba 0.12 2010-05-04 7.0 Christian Brabandt - Small extension to the help file
- generate help file with 'et' set, so the README at github looks better
- Highlight the key binding using |hl-SpecialKey|
- The help tag for the color configuration was wrong.
histwin.vba 0.11 2010-04-21 7.0 Christian Brabandt - Set old buffers read only (disable the setting via the g:undo_tree_nomod variable
- Make sure, Warning Messages are really displayed using :unsilent
histwin.vba 0.10 2010-04-20 7.0 Christian Brabandt - Fixed annoying Resizing bug
- linebreak tags, if they are too long
- dynamically grow the histwin window, for longer tags (up
   to a maximum)
- Bugfix: Always indicate the correct branch
- Added a few try/catch statements and some error handling
histwin.vba 0.9 2010-01-27 7.0 Christian Brabandt BF: Error handling for Replaying (it may not work always)
NF: Finally added Documentation (see :h histwin.txt)
BF: Use syntax highlighting
BF: Tagging finally works (you can now tag additional states)
histwin.vba 0.8 2010-01-21 7.0 Christian Brabandt - NF: make speed of the replay adjustable. Use g:undo_tree_speed to set time in milliseconds
- BF: code cleanup
- BF: highlighting should work better now.
histwin.vba 0.7.2. 2010-01-20 7.0 Christian Brabandt - BF: Check undolevel Settings
- BF: make sure when switching to a different undo branch, that the undo-tree will be updated
histwin.vba 0.7.1 2010-01-20 7.0 Christian Brabandt BF: fixed a problem with mapping the keys which broke the Undo-Tree keys (I guess I don't fully understand, when to use s: and <sid>)
histwin.vba 0.7 2010-01-20 7.0 Christian Brabandt - NF: created autoloadPlugin (patch by Charles Campbell) Thanks!
- NF: enabled GLVS (patch by Charles Campbell) Thanks!
- NF: made Plugin available as histwin.vba
- NF: Check for availability of :UB before defining it
- BF: cleaned up old comments
- BF: deleted :noautocmd which could cause trouble with other plugins
- BF: small changes in coding style (<sid> to s:, fun instead of fu)
histwin.vim 0.6 2010-01-20 7.0 Christian Brabandt BF: fix missing bufname() when creating the undo_tree window
NF: make undo_tree window a little bit smaller (size is adjustable via g:undo_tree_wdth variable)
histwin.vim 0.5 2010-01-20 7.0 Christian Brabandt NF: Allow diffing with selected branch
NF: highlight current version
NF: Use changenr() to determine undobranch
NF: <C-L> updates view
NF: allow switching to initial load state, before buffer was edited
BF: Fix annoying bug, that displays --No lines in buffer--
BF: fix several small annoying bugs
histwin.vim 0.2 2010-01-19 7.2 Christian Brabandt Initial upload
ip used for rating: 18.118.145.114

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github