mundo.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. *mundo.txt* Graph your undo tree so you can actually USE it.
  2. Making Vim's undo tree usable by humans.
  3. ==============================================================================
  4. CONTENTS *Mundo-contents*
  5. 1. Intro ........................... |MundoIntro|
  6. 2. Usage ........................... |MundoUsage|
  7. 3. Configuration ................... |MundoConfig|
  8. 3.1 mundo_width ............... |mundo_width|
  9. 3.2 mundo_preview_height ...... |mundo_preview_height|
  10. 3.3 mundo_preview_bottom ...... |mundo_preview_bottom|
  11. 3.4 mundo_right ............... |mundo_right|
  12. 3.5 mundo_help ................ |mundo_help|
  13. 3.6 mundo_disable ............. |mundo_disable|
  14. 3.7 mundo_map_move_older ...... |mundo_map_move_older|
  15. mundo_map_move_newer ...... |mundo_map_move_newer|
  16. 3.8 mundo_close_on_revert ..... |mundo_close_on_revert|
  17. 3.9 mundo_preview_statusline .. |mundo_preview_statusline|
  18. mundo_tree_statusline ..... |mundo_tree_statusline|
  19. 3.10 mundo_auto_preview ........ |mundo_auto_preview|
  20. 3.11 mundo_verbose_graph ....... |mundo_verbose_graph|
  21. 3.12 mundo_playback_delay ...... |mundo_playback_delay|
  22. 3.13 mundo_mirror_graph ........ |mundo_mirror_graph|
  23. 3.14 mundo_inline_undo ......... |mundo_inline_undo|
  24. 3.15 mundo_return_on_revert .... |mundo_return_on_revert|
  25. 4. License ......................... |MundoLicense|
  26. 5. Bugs ............................ |MundoBugs|
  27. 6. Contributing .................... |MundoContributing|
  28. 7. Changelog ....................... |MundoChangelog|
  29. 8. Credits ......................... |MundoCredits|
  30. ==============================================================================
  31. 1. Intro *MundoIntro*
  32. You know that Vim lets you undo changes like any text editor. What you might
  33. not know is that it doesn't just keep a list of your changes -- it keeps
  34. a goddamed |:undo-tree| of them.
  35. Say you make a change (call it X), undo that change, and then make another
  36. change (call it Y). With most editors, change X is now gone forever. With Vim
  37. you can get it back.
  38. The problem is that trying to do this in the real world is painful. Vim gives
  39. you an |:undolist| command that shows you the leaves of the tree. Good luck
  40. finding the change you want in that list.
  41. Mundo is a plugin to make browsing this ridiculously powerful undo tree less
  42. painful.
  43. ==============================================================================
  44. 2. Usage *MundoUsage*
  45. We'll get to the technical details later, but if you're a human the first
  46. thing you need to do is add a mapping to your |:vimrc| to toggle the undo
  47. graph: >
  48. nnoremap <F5> :MundoToggle<CR>
  49. Change the mapped key to suit your taste. We'll stick with F5 because that's
  50. what the author uses.
  51. Now you can press F5 to toggle the undo graph and preview pane, which will
  52. look something like this: >
  53. Undo graph File
  54. +-----------------------------------+------------------------------------+
  55. | " Mundo for something.txt [1] |one |
  56. | " j/k - move between undo states |two |
  57. | " <cr> - revert to that state |three |
  58. | |five |
  59. | @ [5] 3 hours ago | |
  60. | | | |
  61. | | o [4] 4 hours ago | |
  62. | | | | |
  63. | o | [3] 4 hours ago | |
  64. | | | | |
  65. | w | [2] 4 hours ago | |
  66. | |/ | |
  67. | o [1] 4 hours ago | |
  68. | | | |
  69. | o [0] Original | |
  70. +-----------------------------------+ |
  71. | --- 3 2010-10-12 06:27:35 PM | |
  72. | +++ 5 2010-10-12 07:38:37 PM | |
  73. | @@ -1,3 +1,4 | |
  74. | one | |
  75. | two | |
  76. | three | |
  77. | +five | |
  78. +-----------------------------------+------------------------------------+
  79. Preview pane
  80. Your current position in the undo tree is marked with an '@' character. Undo
  81. positions that were saved to disk are marked with a 'w'. Other nodes are marked
  82. with an 'o' character.
  83. When you toggle open the graph Mundo will put your cursor on your current
  84. position in the tree. You can move up and down the graph with the j and
  85. k keys.
  86. You can move to the top of the graph (the newest state) with gg and to the
  87. bottom of the graph (the oldest state) with G.
  88. As you move between undo states the preview pane will show you a unified diff
  89. of the change that state made.
  90. Pressing enter on a state (or double clicking on it) will revert the contents
  91. of the file to match that state.
  92. You can use p on a state to make the preview window show the diff between
  93. your current state and the selected state, instead of a preview of what the
  94. selected state changed.
  95. Pressing P while on a state will initiate "play to" mode targeted at that
  96. state. This will replay all the changes between your current state and the
  97. target, with a slight pause after each change. It's mostly useless, but can be
  98. fun to watch and see where your editing lags -- that might be a good place to
  99. define a new mapping to speed up your editing.
  100. Pressing q while in the undo graph will close it. You can also just press your
  101. toggle mapping key.
  102. ==============================================================================
  103. 3. Configuration *MundoConfig*
  104. You can tweak the behavior of Mundo by setting a few variables in your :vimrc
  105. file. For example: >
  106. let g:mundo_width = 60
  107. let g:mundo_preview_height = 40
  108. let g:mundo_right = 1
  109. ------------------------------------------------------------------------------
  110. 3.1 g:mundo_width *mundo_width*
  111. Set the horizontal width of the Mundo graph (and preview).
  112. Default: 45
  113. ------------------------------------------------------------------------------
  114. 3.2 g:mundo_preview_height *mundo_preview_height*
  115. Set the vertical height of the Mundo preview.
  116. Default: 15
  117. ------------------------------------------------------------------------------
  118. 3.3 g:mundo_preview_bottom *mundo_preview_bottom*
  119. Force the preview window below current windows instead of below the graph.
  120. This gives the preview window more space to show the unified diff.
  121. Example:
  122. +--------+ +--------+
  123. !g! ! ! !g!
  124. !g! ! or ! !g!
  125. !g!______! !______!g!
  126. !g!pppppp! !pppppp!g!
  127. +--------+ +--------+
  128. Default: 0
  129. ------------------------------------------------------------------------------
  130. 3.4 g:mundo_right *mundo_right*
  131. Set this to 1 to make the Mundo graph (and preview) open on the right side
  132. instead of the left.
  133. Default: 0 (off, open on the left side)
  134. ------------------------------------------------------------------------------
  135. 3.5 g:mundo_help *mundo_help*
  136. Set this to 0 to disable the help text in the Mundo graph window.
  137. Default: 1 (show the help)
  138. ------------------------------------------------------------------------------
  139. 3.6 g:mundo_disable *mundo_disable*
  140. Set this to 1 to disable Mundo entirely.
  141. Useful if you use the same ~/.vim folder on multiple machines, and some of
  142. them may not have Python support.
  143. Default: 0 (Mundo is enabled as usual)
  144. ------------------------------------------------------------------------------
  145. 3.7 g:mundo_map_move_older, g:mundo_map_move_newer *mundo_map_move_older*
  146. *mundo_map_move_newer*
  147. These options let you change the keys that navigate the undo graph. This is
  148. useful if you use a Dvorak keyboard and have changed your movement keys.
  149. Default: mundo_map_move_older = "j"
  150. mundo_map_move_newer = "k"
  151. ------------------------------------------------------------------------------
  152. 3.8 g:mundo_close_on_revert *mundo_close_on_revert*
  153. Set this to 1 to automatically close the Mundo windows when reverting.
  154. Default: 0 (windows do not automatically close)
  155. ------------------------------------------------------------------------------
  156. 3.9 g:mundo_preview_statusline *mundo_preview_statusline*
  157. g:mundo_tree_statusline *mundo_tree_statusline*
  158. Set these to a string to display it as the status line for each Mundo window.
  159. Default: unset (windows use the default statusline)
  160. ------------------------------------------------------------------------------
  161. 3.10 g:mundo_auto_preview *mundo_auto_preview*
  162. Set this to 0 to disable automatically rendering preview diffs as you move
  163. through the undo tree (you can still render a specific diff with r). This can
  164. be useful on large files and undo trees to speed up Mundo.
  165. Default: 1 (automatically preview diffs)
  166. ------------------------------------------------------------------------------
  167. 3.11 g:mundo_verbose_graph *mundo_verbose_graph*
  168. Set this to 0 to create shorter graphs: the 'o' characters will only be used
  169. when multiple branches exist, and extra lines of '|' are suppressed making for
  170. a graph half as long.
  171. Default: 1 (verbose graphs)
  172. ------------------------------------------------------------------------------
  173. 3.12 g:mundo_playback_delay *mundo_playback_delay*
  174. This is the delay in milliseconds between each change when running 'play to'
  175. mode. Set this to a higher number for a slower playback or to a lower number
  176. for a faster playback.
  177. Default: 60
  178. ------------------------------------------------------------------------------
  179. 3.13 g:mundo_mirror_graph *mundo_mirror_graph*
  180. Set this to 0 to align the graph to the left; set to 1 to align to the right.
  181. Default: 1 (mirror graph)
  182. ------------------------------------------------------------------------------
  183. 3.14 g:mundo_inline_graph *mundo_inline_undo*
  184. When enabled, a small one line diff is displayed to the right of the graph undo.
  185. Although not as detailed as a full diff provided in the preview window, it
  186. provides a quick summary of the diff w/o having to navigate.
  187. Default: 0 (no inline graph)
  188. ------------------------------------------------------------------------------
  189. 3.15 g:mundo_return_on_revert *mundo_return_on_revert*
  190. Set this to 0 to keep focus in the Mundo window after a revert.
  191. Default: 1
  192. ==============================================================================
  193. 4. License *MundoLicense*
  194. GPLv2+. Look it up.
  195. ==============================================================================
  196. 5. Bugs *MundoBugs*
  197. If you find a bug please post it on the issue tracker:
  198. https://github.com/simnalamburt/vim-mundo/issues
  199. ==============================================================================
  200. 6. Contributing *MundoContributing*
  201. Think you can make this plugin better? Awesome. Fork it on BitBucket or GitHub
  202. and send a pull request.
  203. GitHub: https://github.com/simnalamburt/vim-mundo
  204. ==============================================================================
  205. 7. Changelog *MundoChangelog*
  206. v3.0.0
  207. * Rename plugin
  208. * Add one line diff in __Mundo__ window.
  209. * Adds g:mundo_mirror_graph setting.
  210. * Adds g:mundo_return_on_revert setting.
  211. * Adds ability to toggle help on/off in __Mundo__ window.
  212. * Adds J and K commands (navigate between written undos)
  213. * Adds /, n and N commands (search undos)
  214. * Adds g:mundo_verbose_graph setting.
  215. * Adds g:mundo_mirror_graph setting.
  216. * Show written undos in the Mundo graph.
  217. * Adds live reload of Mundo as you edit.
  218. v2.5.0
  219. * Fix the help window to take custom mappings into account.
  220. * Add g:mundo_playback_delay option.
  221. v2.4.0
  222. * Add auto preview option.
  223. * Add 'r' mapping to preview current state.
  224. * Add public mundo#MundoShow() and mundo#MundoHide() functions.
  225. v2.3.0
  226. * Add statusline configuration.
  227. v2.2.2
  228. * More performance improvements.
  229. v2.2.1
  230. * Refactoring and performance improvements.
  231. v2.2.0
  232. * Add the g:mundo_close_on_revert setting.
  233. * Fix a bug with the splitbelow setting.
  234. v2.1.1
  235. * Fix a bug with the movement key mappings.
  236. v2.1.0
  237. * Warnings about having an incompatible Vim and/or Python installation
  238. are now deferred until the first time you try to use Mundo, instead
  239. of being displayed on launch.
  240. * The <j> and <k> mappings are now configurable with
  241. g:mundo_map_move_older and g:mundo_map_move_newer.
  242. * The o, <Up> and <Down> keys are now mapped in the Mundo pane.
  243. * Improve and add several unit tests for Mundo.
  244. v2.0.0
  245. * Make MundoToggle close the Mundo windows if they're visible but not the
  246. current window, instead of moving to them.
  247. * Add the g:mundo_help setting.
  248. * Add the g:mundo_disable setting.
  249. * Add the 'p' mapping to preview the result of reverting to the selected
  250. state.
  251. * Fix movement commands with counts in the graph.
  252. v1.0.0
  253. * Initial stable release.
  254. ==============================================================================
  255. 8. Credits *MundoCredits*
  256. The graphing code was all taken from Mercurial, hence the GPLv2+ license.
  257. The plugin was heavily inspired by histwin.vim, and the code for scratch.vim
  258. helped the author get started.
  259. ==============================================================================