1 *undotree.txt* Display your undo history in a graph
3 Author: Ming Bai <mbbill AT gmail DOT COM>
5 Homepage: https://github.com/mbbill/undotree/
8 ==============================================================================
9 CONTENTS *undotree-contents*
11 1. Intro ................................ |undotree-intro|
12 2. Usage ................................ |undotree-usage|
13 3. Configuration ........................ |undotree-config|
14 3.1 undotree_WindowLayout .......... |undotree_WindowLayout|
15 3.2 undotree_SplitWidth ............ |undotree_SplitWidth|
16 3.3 undotree_DiffpanelHeight ....... |undotree_DiffpanelHeight|
17 3.4 undotree_DiffAutoOpen .......... |undotree_DiffAutoOpen|
18 3.5 undotree_SetFocusWhenToggle .... |undotree_SetFocusWhenToggle|
19 3.6 undotree_TreeNodeShape ......... |undotree_TreeNodeShape|
20 3.7 undotree_DiffCommand ........... |undotree_DiffCommand|
21 3.8 undotree_RelativeTimestamp ..... |undotree_RelativeTimestamp|
22 3.9 undotree_HighlightChangedText .. |undotree_HighlightChangedText|
23 3.10 undotree_HighlightSyntaxAdd .... |undotree_HighlightSyntaxAdd|
24 undotree_HighlightSyntaxChange . |undotree_HighlightSyntaxChange|
25 3.11 Undotree_CustomMap ............. |Undotree_CustomMap|
26 4. Bugs ................................. |undotree-bugs|
27 5. Changelog ............................ |undotree-changelog|
28 6. License .............................. |undotree-license|
30 ==============================================================================
31 1. Intro *undotree-intro*
33 Vim 7.0 added a new feature named Undo branches. Basically it's a kind of
34 ability to go back to the text after any change, even if they were undone. Vim
35 stores undo history in a tree which you can browse and manipulate through a
36 bunch of commands. But that was not enough straightforward and a bit hard to
37 use. You may use :help |new-undo-branches| or :help |undo-tree| to get more
38 detailed help. Now this plug-in will free you from those commands and bring
39 back the power of undo tree.
41 ==============================================================================
42 2. Usage *undotree-usage*
44 Use :UndotreeToggle to toggle the undo-tree panel. You may want to map this
45 command to whatever hotkey by adding the following line to your vimrc, take F5
48 nnoremap <F5> :UndotreeToggle<cr>
50 Then you can try to do some modification, and the undo tree will automatically
53 There are some hotkeys provided by vim to switch between the changes in
54 history, like |u|, |<c-r>|, |g+|, |g-| as well as the |:earlier| and |:later|
57 You may also switch to undotree panel and use the hotkeys to switch between
58 history versions. Press ? in undotree window for quick help of hotkeys.
60 You can monitor the changed text in diff panel which is automatically updated
61 when undo/redo happens.
64 It is highly recommend to enable the persistent undo. If you don't like your
65 working directory be messed up with the undo file everywhere, you may add the
66 following line to your vimrc in order to make them stored together.
68 if has("persistent_undo")
69 set undodir='~/.undodir/'
73 ==============================================================================
74 3. Configuration *undotree-config*
76 ------------------------------------------------------------------------------
77 3.1 g:undotree_WindowLayout *undotree_WindowLayout*
79 Set the undotree window layout.
83 +----------+------------------------+
93 +----------+------------------------+
97 +----------+------------------------+
103 +----------+------------------------+
107 +-----------------------------------+
111 +------------------------+----------+
121 +------------------------+----------+
125 +------------------------+----------+
131 +------------------------+----------+
135 +-----------------------------------+
139 ------------------------------------------------------------------------------
140 3.2 g:undotree_SplitWidth *undotree_SplitWidth*
142 Set the undotree window width.
146 ------------------------------------------------------------------------------
147 3.3 g:undotree_DiffpanelHeight *undotree_DiffpanelHeight*
149 Set the diff window height.
153 ------------------------------------------------------------------------------
154 3.4 g:undotree_DiffAutoOpen *undotree_DiffAutoOpen*
156 Set this to 1 to auto open the diff window.
160 ------------------------------------------------------------------------------
161 3.5 g:undotree_SetFocusWhenToggle *undotree_SetFocusWhenToggle*
163 If set to 1, the undotree window will get focus after being opened, otherwise
164 focus will stay in current window.
168 ------------------------------------------------------------------------------
169 3.6 g:undotree_TreeNodeShape *undotree_TreeNodeShape*
171 Set the tree node shape.
175 ------------------------------------------------------------------------------
176 3.7 g:undotree_DiffCommand *undotree_DiffCommand*
178 Set the command used to get the diff output.
182 ------------------------------------------------------------------------------
183 3.8 g:undotree_RelativeTimestamp *undotree_RelativeTimestamp*
185 Set to 1 to use relative timestamp.
189 ------------------------------------------------------------------------------
190 3.9 g:undotree_HighlightChangedText *undotree_HighlightChangedText*
192 Set to 1 to highlight the changed text.
196 ------------------------------------------------------------------------------
197 3.10 g:undotree_HighlightSyntaxAdd *undotree_HighlightSyntaxAdd*
198 g:undotree_HighlightSyntaxChange *undotree_HighlightSyntaxChange*
200 Set the highlight linked syntax type.
201 You may chose your favorite through ":hi" command.
203 Default: "DiffAdd" and "DiffChange"
205 ------------------------------------------------------------------------------
206 3.11 g:Undotree_CustomMap *Undotree_CustomMap*
208 There are two ways of changing the default key mappings:
209 The first way is to define global mappings as the following example:
211 nmap <buffer> J <plug>UndotreeGoNextState
212 nmap <buffer> K <plug>UndotreeGoPreviousState
214 A better approach is to define the callback function g:Undotree_CustomMap().
215 The function will be called after the undotree windows is initialized, so the
216 key mappings only works on the undotree windows.
218 function g:Undotree_CustomMap()
219 nmap <buffer> J <plug>UndotreeGoNextState
220 nmap <buffer> K <plug>UndotreeGoPreviousState
223 List of the commands available for redefinition.
227 <plug>UndotreeFocusTarget
228 <plug>UndotreeClearHistory
229 <plug>UndotreeTimestampToggle
230 <plug>UndotreeDiffToggle
231 <plug>UndotreeGoNextState
232 <plug>UndotreeGoPreviousState
233 <plug>UndotreeGoNextSaved
234 <plug>UndotreeGoPreviousSaved
240 ==============================================================================
241 4. Bugs *undotree-bugs*
243 Post any issue and feature request here:
244 https://github.com/mbbill/undotree/issues
246 ==============================================================================
247 5. Changelog *undotree-changelog*
250 - Several fixes and enhancements.
253 - Fixed some small issue.
256 - Enhanced tree style.
257 - Multi-window switching support.
260 - Live updated highlight for changed text.
261 - Customizable key mappings.
262 - Fixed some minor bugs.
266 - Add relative timestamp.
267 - Add ability of clear undo history.
271 - Performance improvement.
277 - Fixed some annoying issues.
281 - Handle undo levels.
288 ==============================================================================
289 6. License *undotree-license*