Source

gundo.vim / site / index.html

Full commit
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<!DOCTYPE html>
<html>
    <head>
        <title>Gundo - Visualize your Vim Undo Tree</title>
        <base href="/gundo.vim/">

        <link rel="stylesheet/less" href="style.less" type="text/css">
        <script src="less.js" type="text/javascript"></script>

        <script type="text/javascript">
        /* <![CDATA[ */
            (function() {
                var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];

                s.type = 'text/javascript';
                s.async = true;
                s.src = 'http://api.flattr.com/js/0.5.0/load.js?mode=auto';

                t.parentNode.insertBefore(s, t);
            })();
        /* ]]> */
        </script>

        <script type="text/javascript">
          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-15328874-3']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
          })();
        </script>
    </head>

    <body>
        <div id="repos">
            <a href="http://bitbucket.org/sjl/gundo.vim/">Mercurial Repository</a><br/>
            <a href="http://github.com/sjl/gundo.vim/">Git Repository</a><br/>

            <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://bitbucket.org/sjl/gundo.vim/"></a>
        </div>
        <div class="wrap">
            <header>
                <h1>Gundo</h1>
                <h2>Graph your Vim undo tree in style.</h2>
            </header>
            <section>
                <a href="http://www.flickr.com/photos/sjl7678/5093114605/"
                   title="gundo by stevelosh, on Flickr"
                ><img src="http://farm5.static.flickr.com/4113/5093114605_ebc46d6494_m.jpg"
                   width="234" height="240" alt="gundo" /></a>


                <p>
                    You know that Vim lets you undo changes like any text editor. What you might
                    not know is that it doesn't just keep a list of your changes &mdash; it keeps
                    a goddamed <a href="http://vim.wikia.com/wiki/Using_undo_branches">tree</a> of them.
                </p>

                <p>
                    Say you make a change (call it X), undo that change, and then make another
                    change (call it Y). With most editors, change X is now gone forever. With Vim
                    you can get it back.
                </p>

                <p>
                    The problem is that trying to do this in the real world is painful. Vim gives
                    you an <code>:undolist</code> command that shows you the leaves of the tree. Good luck
                    finding the change you want in that list.
                </p>

                <p>
                    Gundo is a plugin to make browsing this ridiculously powerful undo tree less
                    painful.
                </p>

                <p>
                    Check out this
                    <a href="http://screenr.com/M9l">quick screencast</a>
                    if you want to see it in action.
                </p>
            </section>
            <nav>
                <ol>
                    <li><a href="#requirements">Requirements</a></li>
                    <li><a href="#installation">Installation</a></li>
                    <li><a href="#usage">Usage</a></li>
                    <li>
                        <a href="#configuration">Configuration</a>
                        <ul>
                            <li><a href="#gundo_width">g:gundo_width</a></li>
                            <li><a href="#gundo_preview_height">g:gundo_preview_height</a></li>
                            <li><a href="#gundo_preview_bottom">g:gundo_preview_bottom</a></li>
                            <li><a href="#gundo_right">g:gundo_right</a></li>
                            <li><a href="#gundo_help">g:gundo_help</a></li>
                            <li><a href="#gundo_disable">g:gundo_disable</a></li>
                            <li><a href="#gundo_map_move">g:gundo_map_move_[older/newer]</a></li>
                            <li><a href="#gundo_close_on_revert">g:gundo_close_on_revert</a></li>
                            <li><a href="#gundo_statusline">g:gundo_[preview/tree]_statusline</a></li>
                            <li><a href="#gundo_auto_preview">g:gundo_auto_preview</a></li>
                        </ul>
                    </li>
                    <li><a href="#license">License</a></li>
                    <li><a href="#bugs">Bugs</a></li>
                    <li><a href="#contributing">Contributing</a></li>
                    <li><a href="#changelog">Changelog</a></li>
                    <li><a href="#credits">Credits</a></li>
                </ol>
            </nav>
            <section>
                <a name="requirements"></a>
                <h1>Requirements</h1>

                <p>
                    Gundo requires Vim 7.3+ compiled with Python support, and Python 2.4+.
                </p>
            </section>
            <section>
                <a name="installation"></a>
                <h1>Installation</h1>

                <p>Use Pathogen. Don't use pathogen? Start.</p>
                <pre>hg clone http://bitbucket.org/sjl/gundo.vim ~/.vim/bundle/gundo</pre>

                <p>There's a git mirror if you prefer:</p>
                <pre>git clone http://github.com/sjl/gundo.vim.git ~/.vim/bundle/gundo</pre>

                <p>Add a mapping to your ~/.vimrc (change the key to suit your taste):</p>
                <pre>nnoremap &lt;F5&gt; :GundoToggle&lt;CR&gt;</pre>
            </section>
            <section>
                <a name="usage"></a>
                <h1>Usage</h1>

                <p>
                    We'll get to the technical details later, but if you're a human the first
                    thing you need to do is add a mapping to your vimrc file to toggle the undo
                    graph:
                </p>

                <pre>nnoremap &lt;F5&gt; :GundoToggle&lt;CR&gt;</pre>

                <p>
                    Change the mapped key to suit your taste. We'll stick with <code>&lt;F5&gt;</code> because that's
                    what the author uses.
                </p>

                <p>
                    Now you can press <code>&lt;F5&gt;</code> to toggle the undo graph and preview pane, which will
                    look something like this:
                </p>

<pre>
  Undo graph                          File
+-----------------------------------+---------------------------+
| " Gundo for something.txt [1]     |one                        |
| " j/k  - move between undo states |two                        |
| " &lt;cr&gt; - revert to that state     |three                      |
|                                   |five                       |
| @  [5] 3 hours ago                |                           |
| |                                 |                           |
| | o  [4] 4 hours ago              |                           |
| | |                               |                           |
| o |  [3] 4 hours ago              |                           |
| | |                               |                           |
| o |  [2] 4 hours ago              |                           |
| |/                                |                           |
| o  [1] 4 hours ago                |                           |
| |                                 |                           |
| o  [0] Original                   |                           |
+-----------------------------------+                           |
| --- 3 2010-10-12 06:27:35 PM      |                           |
| +++ 5 2010-10-12 07:38:37 PM      |                           |
| @@ -1,3 +1,4                      |                           |
|  one                              |                           |
|  two                              |                           |
|  three                            |                           |
| +five                             |                           |
+-----------------------------------+---------------------------+
  Preview pane
</pre>

                <p>
                    Your current position in the undo tree is marked with an <code>@</code> character. Other
                    nodes are marked with an <code>o</code> character.
                </p>

                <p>
                    When you toggle open the graph Gundo will put your cursor on your current
                    position in the tree. You can move up and down the graph with the <code>j</code> and
                    <code>k</code> keys.
                </p>

                <p>
                    You can move to the top of the graph (the newest state) with <code>gg</code> and to the
                    bottom of the graph (the oldest state) with <code>G</code>.
                </p>

                <p>
                    As you move between undo states the preview pane will show you a unified diff
                    of the change that state made.
                </p>

                <p>
                    Pressing <code>return</code> on a state (or double clicking on it) will
                    revert the contents of the file to match that state.
                </p>

                <p>
                    You can use <code>p</code> on a state to make the preview window show the
                    diff between your current state and the selected state, instead of a preview
                    of what the selected state changed.
                </p>

                <p>
                    Pressing <code>P</code> while on a state will initiate "play to" mode targeted at that
                    state. This will replay all the changes between your current state and the
                    target, with a slight pause after each change. It's mostly useless, but can be
                    fun to watch and see where your editing lags &mdash; that might be a good place to
                    define a new mapping to speed up your editing.
                </p>

                <p>
                    Pressing <code>q</code> while in the undo graph will close it.  You can also just press your
                    toggle mapping key.
                </p>
            </section>
            <section>
                <a name="configuration"></a>
                <h1>Configuration</h1>

                <p>
                    You can tweak the behavior of Gundo by setting a few variables
                    in your :vimrc file. For example:
                </p>

<pre>
let g:gundo_width = 60
let g:gundo_preview_height = 40
let g:gundo_right = 1
</pre>

                <a name="gundo_width"></a>
                <h2>g:gundo_width</h2>

                <p>Set the horizontal width of the Gundo graph (and preview).</p>

                <p>Default: 45</p>

                <a name="gundo_preview_height"></a>
                <h2>g:gundo_preview_height</h2>

                <p>Set the vertical height of the Gundo preview.</p>

                <p>Default: 15</p>

                <a name="gundo_preview_bottom"></a>
                <h2>g:gundo_preview_bottom</h2>

                <p>
                    Force the preview window below current windows instead of below
                    the graph.  This gives the preview window more space to show the
                    unified diff.
                </p>

                <p>Example:</p>

<pre>
+--------+            +--------+
!g!      !            !      !g!
!g!      !     or     !      !g!
!g!______!            !______!g!
!g!pppppp!            !pppppp!g!
+--------+            +--------+
</pre>

                <p>Default: 0</p>

                <a name="gundo_right"></a>
                <h2>g:gundo_right</h2>

                <p>
                    Set this to 1 to make the Gundo graph (and preview) open on the
                    right side instead of the left.
                </p>

                <p>Default: 0 (off, open on the left side)</p>

                <a name="gundo_help"></a>
                <h2>g:gundo_help</h2>

                <p>Set this to 0 to disable the help text in the Gundo graph window.</p>

                <p>Default: 1 (show the help)</p>

                <a name="gundo_disable"></a>
                <h2>g:gundo_disable</h2>

                <p>Set this to 1 to disable Gundo entirely.</p>

                <p>
                    Useful if you use the same <code>~/.vim</code> folder on
                    multiple machines, and some of them may not have Python support.
                </p>

                <p>Default: 0 (Gundo is enabled as usual)</p>

                <a name="gundo_map_move"></a>
                <h2>g:gundo_map_move_[older/newer]</h2>

                <p>
                    These options let you change the keys that navigate the
                    undo graph. This is useful if you use a Dvorak keyboard and
                    have changed your movement keys.
                </p>

                <p>
                    Default:<br/>
                    gundo_map_move_older: "j"<br/>
                    gundo_map_move_newer: "k"
                </p>

                <a name="gundo_close_on_revert"></a>
                <h2>g:gundo_close_on_revert</h2>

                <p>Set this to 1 to automatically close the Gundo windows when reverting.</p>

                <p>Default: 0 (windows do not automatically close)</p>

                <a name="gundo_statusline"></a>
                <h2>g:gundo_[preview/tree]_statusline</h2>

                <p>Set these to a string to display it as the status line for each Gundo window.</p>

                <p>Default: unset (windows use the default statusline)</p>


                <a name="#gundo_auto_preview"></a>
                <h2>g:gundo_auto_preview</h2>

                <p>Set this to 1 to rendering diff automatically with cursor move.</p>

                <p>Default: 1 (auto preview diff)</p>
            </section>
            <section>
                <a name="license"></a>
                <h1>License</h1>

                <p><a href="http://www.opensource.org/licenses/gpl-2.0.php">GPLv2+</a>.</p>
            </section>
            <section>
                <a name="bugs"></a>
                <h1>Bugs</h1>

                <p>
                    If you find a bug please post it on the
                    <a href="http://bitbucket.org/sjl/gundo.vim/issues?status=new&status=open">issue tracker</a>.
                </p>
            </section>
            <section>
                <a name="contributing"></a>
                <h1>Contributing</h1>

                <p>
                    Fork the repository on
                    <a href="http://bitbucket.org/sjl/gundo.vim/">BitBucket</a>
                    or
                    <a href="http://github.com/sjl/gundo.vim/">GitHub</a>
                    and send a pull request.
                </p>

                <p>Make sure you document your changes in the following places:</p>

                <ul>
                    <li>The <code>README.markdown</code> file.</li>
                    <li>The <code>site/index.html</code> file.</li>
                    <li>The <code>doc/gundo.txt</code> file.</li>
                </ul>
            </section>
            <section>
                <a name="changelog"></a>
                <h1>Changelog</h1>

                <ol class="changelog">
                    <li>v2.3.1
                        <ul>
                            <li>
                                Add auto preview option.
                            </li>
                            <li>
                                Add 'r' mapping to preview current state.
                            </li>
                        </ul>
                    </li>
                    <li>v2.3.0
                        <ul>
                            <li>
                                Add statusline configuration.
                            </li>
                        </ul>
                    </li>
                    <li>v2.2.2
                        <ul>
                            <li>
                                More performance improvements.
                            </li>
                        </ul>
                    </li>
                    <li>v2.2.1
                        <ul>
                            <li>
                                Refactoring and performance improvements.
                            </li>
                        </ul>
                    </li>
                    <li>v2.2.0
                        <ul>
                            <li>
                                Add the <code>g:gundo_close_on_revert</code> setting.
                            </li>
                            <li>
                                Fix a bug with the <code>splitbelow</code> setting.
                            </li>
                        </ul>
                    </li>
                    <li>v2.1.1
                        <ul>
                            <li>
                                Fix a bug with the movement key mappings.
                            </li>
                        </ul>
                    </li>
                    <li>v2.1.0
                        <ul>
                            <li>
                                Warnings about having an incompatible Vim and/or
                                Python installation are now deferred until the
                                first time you try to use Gundo, instead of being
                                displayed on launch.
                            </li>
                            <li>
                                The <code>j</code> and <code>k</code> mappings are
                                now configurable with
                                <code>g:gundo_map_move_older</code> and
                                <code>g:gundo_map_move_newer</code>.
                            </li>
                            <li>
                                The <code>o</code>, <code>Up</code> and
                                <code>Down</code> keys are now mapped in the
                                Gundo pane.
                            </li>
                            <li>
                                Improve and add several unit tests for Gundo.
                            </li>
                        </ul>
                    </li>
                    <li>v2.0.0
                        <ul>
                            <li>
                                Make <code>GundoToggle</code> close the Gundo windows if they're
                                visible but not the current window, instead of moving to them.
                            </li>
                            <li>Add the <code>g:gundo_disable</code> setting.</li>
                            <li>Add the <code>g:gundo_help</code> setting.</li>
                            <li>
                                Add the <code>p</code> mapping to preview the result of
                                reverting to the selected state.
                            </li>
                            <li>Fix movement commands with counts in the graph.</li>
                        </ul>
                    </li>
                    <li>v1.0.0
                        <ul>
                            <li>Initial stable release.</li>
                        </ul>
                    </li>
                </ol>
            </section>
            <section>
                <a name="credits"></a>
                <h1>Credits</h1>

                <p>
                    The graphing code was all taken from Mercurial, hence the
                    GPLv2+ license.
                </p>

                <p>
                    The plugin was heavily inspired by histwin.vim, and the code
                    for scratch.vim helped the author get started.
                </p>
            </section>
            <footer>
                Gundo was written by
                <a href="http://stevelosh.com">Steve Losh</a>
                with a lot of help from others.
            </footer>
        </div>
    </body>
</html>