From e17eb8870dc224b82e970f1667e753c480280630 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 20 Oct 2010 15:15:02 +0200 Subject: Added gundo to vim --- .vim/bundle/gundo.vim/.hg/00changelog.i | Bin 0 -> 57 bytes .vim/bundle/gundo.vim/.hg/branch | 1 + .vim/bundle/gundo.vim/.hg/branchheads.cache | 2 + .vim/bundle/gundo.vim/.hg/dirstate | Bin 0 -> 185 bytes .vim/bundle/gundo.vim/.hg/hgrc | 2 + .vim/bundle/gundo.vim/.hg/requires | 3 + .vim/bundle/gundo.vim/.hg/store/00changelog.i | Bin 0 -> 6899 bytes .vim/bundle/gundo.vim/.hg/store/00manifest.i | Bin 0 -> 5751 bytes .vim/bundle/gundo.vim/.hg/store/data/.hgignore.i | Bin 0 -> 171 bytes .vim/bundle/gundo.vim/.hg/store/data/.hgtags.i | Bin 0 -> 237 bytes .../.hg/store/data/_r_e_a_d_m_e.markdown.i | Bin 0 -> 1447 bytes .../gundo.vim/.hg/store/data/doc/gundo.txt.i | Bin 0 -> 2698 bytes .../gundo.vim/.hg/store/data/plugin/gundo.vim.i | Bin 0 -> 15222 bytes .vim/bundle/gundo.vim/.hg/store/fncache | 5 + .vim/bundle/gundo.vim/.hg/store/undo | Bin 0 -> 141 bytes .vim/bundle/gundo.vim/.hg/tags.cache | 4 + .vim/bundle/gundo.vim/.hg/undo.branch | 1 + .vim/bundle/gundo.vim/.hg/undo.dirstate | 0 .vim/bundle/gundo.vim/.hgignore | 5 + .vim/bundle/gundo.vim/.hgtags | 2 + .vim/bundle/gundo.vim/README.markdown | 50 ++ .vim/bundle/gundo.vim/doc/gundo.txt | 128 ++++ .vim/bundle/gundo.vim/doc/tags | 8 + .vim/bundle/gundo.vim/plugin/gundo.vim | 795 +++++++++++++++++++++ 24 files changed, 1006 insertions(+) create mode 100644 .vim/bundle/gundo.vim/.hg/00changelog.i create mode 100644 .vim/bundle/gundo.vim/.hg/branch create mode 100644 .vim/bundle/gundo.vim/.hg/branchheads.cache create mode 100644 .vim/bundle/gundo.vim/.hg/dirstate create mode 100644 .vim/bundle/gundo.vim/.hg/hgrc create mode 100644 .vim/bundle/gundo.vim/.hg/requires create mode 100644 .vim/bundle/gundo.vim/.hg/store/00changelog.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/00manifest.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/data/.hgignore.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/data/.hgtags.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/data/_r_e_a_d_m_e.markdown.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/data/doc/gundo.txt.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/data/plugin/gundo.vim.i create mode 100644 .vim/bundle/gundo.vim/.hg/store/fncache create mode 100644 .vim/bundle/gundo.vim/.hg/store/undo create mode 100644 .vim/bundle/gundo.vim/.hg/tags.cache create mode 100644 .vim/bundle/gundo.vim/.hg/undo.branch create mode 100644 .vim/bundle/gundo.vim/.hg/undo.dirstate create mode 100644 .vim/bundle/gundo.vim/.hgignore create mode 100644 .vim/bundle/gundo.vim/.hgtags create mode 100644 .vim/bundle/gundo.vim/README.markdown create mode 100644 .vim/bundle/gundo.vim/doc/gundo.txt create mode 100644 .vim/bundle/gundo.vim/doc/tags create mode 100644 .vim/bundle/gundo.vim/plugin/gundo.vim (limited to '.vim') diff --git a/.vim/bundle/gundo.vim/.hg/00changelog.i b/.vim/bundle/gundo.vim/.hg/00changelog.i new file mode 100644 index 0000000..d3a8311 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/00changelog.i differ diff --git a/.vim/bundle/gundo.vim/.hg/branch b/.vim/bundle/gundo.vim/.hg/branch new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/branch @@ -0,0 +1 @@ +default diff --git a/.vim/bundle/gundo.vim/.hg/branchheads.cache b/.vim/bundle/gundo.vim/.hg/branchheads.cache new file mode 100644 index 0000000..d2ce2b6 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/branchheads.cache @@ -0,0 +1,2 @@ +40049e1b235d68d8d4e35d3f21bab89fd39fbc1a 36 +40049e1b235d68d8d4e35d3f21bab89fd39fbc1a default diff --git a/.vim/bundle/gundo.vim/.hg/dirstate b/.vim/bundle/gundo.vim/.hg/dirstate new file mode 100644 index 0000000..4cd2e90 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/dirstate differ diff --git a/.vim/bundle/gundo.vim/.hg/hgrc b/.vim/bundle/gundo.vim/.hg/hgrc new file mode 100644 index 0000000..9e0829e --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/hgrc @@ -0,0 +1,2 @@ +[paths] +default = http://bitbucket.org/sjl/gundo.vim diff --git a/.vim/bundle/gundo.vim/.hg/requires b/.vim/bundle/gundo.vim/.hg/requires new file mode 100644 index 0000000..5175383 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/requires @@ -0,0 +1,3 @@ +revlogv1 +store +fncache diff --git a/.vim/bundle/gundo.vim/.hg/store/00changelog.i b/.vim/bundle/gundo.vim/.hg/store/00changelog.i new file mode 100644 index 0000000..2e446d0 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/00changelog.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/00manifest.i b/.vim/bundle/gundo.vim/.hg/store/00manifest.i new file mode 100644 index 0000000..444bbb1 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/00manifest.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/data/.hgignore.i b/.vim/bundle/gundo.vim/.hg/store/data/.hgignore.i new file mode 100644 index 0000000..0eb9036 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/data/.hgignore.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/data/.hgtags.i b/.vim/bundle/gundo.vim/.hg/store/data/.hgtags.i new file mode 100644 index 0000000..7b958a5 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/data/.hgtags.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/data/_r_e_a_d_m_e.markdown.i b/.vim/bundle/gundo.vim/.hg/store/data/_r_e_a_d_m_e.markdown.i new file mode 100644 index 0000000..ef8a1d4 Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/data/_r_e_a_d_m_e.markdown.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/data/doc/gundo.txt.i b/.vim/bundle/gundo.vim/.hg/store/data/doc/gundo.txt.i new file mode 100644 index 0000000..2ef255c Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/data/doc/gundo.txt.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/data/plugin/gundo.vim.i b/.vim/bundle/gundo.vim/.hg/store/data/plugin/gundo.vim.i new file mode 100644 index 0000000..9f8f1df Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/data/plugin/gundo.vim.i differ diff --git a/.vim/bundle/gundo.vim/.hg/store/fncache b/.vim/bundle/gundo.vim/.hg/store/fncache new file mode 100644 index 0000000..3aa89ae --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/store/fncache @@ -0,0 +1,5 @@ +data/.hgignore.i +data/.hgtags.i +data/README.markdown.i +data/doc/gundo.txt.i +data/plugin/gundo.vim.i diff --git a/.vim/bundle/gundo.vim/.hg/store/undo b/.vim/bundle/gundo.vim/.hg/store/undo new file mode 100644 index 0000000..20f94ae Binary files /dev/null and b/.vim/bundle/gundo.vim/.hg/store/undo differ diff --git a/.vim/bundle/gundo.vim/.hg/tags.cache b/.vim/bundle/gundo.vim/.hg/tags.cache new file mode 100644 index 0000000..1f51c3d --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/tags.cache @@ -0,0 +1,4 @@ +36 40049e1b235d68d8d4e35d3f21bab89fd39fbc1a e2c49b93bf7f235e769a8b5cfae330dc2edb8180 + +4101cbccf1d5fd0cfb81a3c6757c8f71657c1243 semver +4101cbccf1d5fd0cfb81a3c6757c8f71657c1243 v0.8.0 diff --git a/.vim/bundle/gundo.vim/.hg/undo.branch b/.vim/bundle/gundo.vim/.hg/undo.branch new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hg/undo.branch @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/.vim/bundle/gundo.vim/.hg/undo.dirstate b/.vim/bundle/gundo.vim/.hg/undo.dirstate new file mode 100644 index 0000000..e69de29 diff --git a/.vim/bundle/gundo.vim/.hgignore b/.vim/bundle/gundo.vim/.hgignore new file mode 100644 index 0000000..90c2787 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hgignore @@ -0,0 +1,5 @@ +syntax:glob + +*.un~ +*.pyc +tags diff --git a/.vim/bundle/gundo.vim/.hgtags b/.vim/bundle/gundo.vim/.hgtags new file mode 100644 index 0000000..78bebd9 --- /dev/null +++ b/.vim/bundle/gundo.vim/.hgtags @@ -0,0 +1,2 @@ +4101cbccf1d5fd0cfb81a3c6757c8f71657c1243 v0.8.0 +4101cbccf1d5fd0cfb81a3c6757c8f71657c1243 semver diff --git a/.vim/bundle/gundo.vim/README.markdown b/.vim/bundle/gundo.vim/README.markdown new file mode 100644 index 0000000..a27c8f1 --- /dev/null +++ b/.vim/bundle/gundo.vim/README.markdown @@ -0,0 +1,50 @@ + +Flattr this + +Gundo.vim is Vim plugin to visualize your Vim undo tree. + +Current status: Beta. It might eat your data. Be careful. +========================================================= + +Preview +------- + + +Screenshot: + +gundo + +Screencast: [http://screenr.com/M9l](http://screenr.com/M9l) + + +Requirements +------------ + +* Vim 7.3+ +* Python support for Vim. +* Python 2.5+. + +Installation +------------ + +Use [Pathogen][]. Don't use pathogen? Start. + +Add a mapping to your `~/.vimrc` (change the key to suit your taste): + + nnoremap :GundoToggle + +[Pathogen]: http://www.vim.org/scripts/script.php?script_id=2332 + +Usage +----- + +When you're editing a file you can bring up the undo graph for that file with +`` (or whatever key you mapped it to). + +Press `` again to close the undo graph and return to your file. + +Use `j` and `k` to move up and down the graph. The preview pane will update with +a diff of the change made by the undo state you're currently on. + +Press return to revert the file's contents to that undo state and return to the +file. diff --git a/.vim/bundle/gundo.vim/doc/gundo.txt b/.vim/bundle/gundo.vim/doc/gundo.txt new file mode 100644 index 0000000..c8498c1 --- /dev/null +++ b/.vim/bundle/gundo.vim/doc/gundo.txt @@ -0,0 +1,128 @@ +*gundo.txt* Graph your undo tree so you can actually USE it. + + + CURRENT STATUS: BETA + + IT MIGHT EAT YOUR DATA + + SERIOUSLY: IF YOU USE THIS PLUGIN, LOSE DATA AND COMPLAIN ABOUT IT + I AM GOING TO MAKE FUN OF YOU ON TWITTER + + +Making's Vim's undo tree usable by humans. + +============================================================================== +1. Intro *Gundo-plugin* *Gundo* + +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 -- it keeps +a goddamed |:undo-tree| of them. + +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. + +The problem is that trying to do this in the real world is painful. Vim gives +you an |:undolist| command that shows you the leaves of the tree. Good luck +finding the change you want in that list. + +Gundo is a plugin to make browsing this ridiculously powerful undo tree less +painful. + +============================================================================== +2. Usage *GundoUsage* + +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| to toggle the undo +graph: > + + nnoremap :GundoToggle + +Change the mapped key to suit your taste. We'll stick with F5 because that's +what the author uses. + +Now you can press F5 to toggle the undo graph and preview pane, which will +look something like this: > + + Undo graph File + +-----------------------------------+------------------------------------+ + | " Gundo for something.txt [1] |one | + | " j/k - move between undo states |two | + | " - 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 + +Your current position in the undo tree is marked with an '@' character. Other +nodes are marked with an 'o' character. + +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 j and +k keys. + +You can move to the top of the graph (the newest state) with gg and to the +bottom of the graph (the oldest state) with G. + +As you move between undo states the preview pane will show you a unified diff +of the change that state made. + +Pressing enter on a state will revert the contents of the file to match that +state. + +Pressing P 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 -- that might be a good place to +define a new mapping to speed up your editing. + +Pressing q while in the undo graph will close it. You can also just press your +toggle mapping key. + +============================================================================== +3. License *GundoLicense* + +GPLv2+. Look it up. + +============================================================================== +4. Bugs *GundoBugs* + +If you find a bug please post it on the issue tracker: +http://bitbucket.org/sjl/gundo.vim/issues?status=new&status=open + +============================================================================== +5. Contributing *GundoContributing* + +Think you can make this plugin better? Awesome. Fork it on BitBucket or GitHub +and send a pull request. + +BitBucket: http://bitbucket.org/sjl/gundo.vim/ +GitHub: http://github.com/sjl/gundo.vim/ + +============================================================================== +6. Credits *GundoCredits* + +The graphing code was all taken from Mercurial, hence the GPLv2+ license. + +The plugin was heavily inspired by histwin.vim, and the code for scratch.vim +helped the author get started. + +============================================================================== diff --git a/.vim/bundle/gundo.vim/doc/tags b/.vim/bundle/gundo.vim/doc/tags new file mode 100644 index 0000000..ba84bf9 --- /dev/null +++ b/.vim/bundle/gundo.vim/doc/tags @@ -0,0 +1,8 @@ +Gundo gundo.txt /*Gundo* +Gundo-plugin gundo.txt /*Gundo-plugin* +GundoBugs gundo.txt /*GundoBugs* +GundoContributing gundo.txt /*GundoContributing* +GundoCredits gundo.txt /*GundoCredits* +GundoLicense gundo.txt /*GundoLicense* +GundoUsage gundo.txt /*GundoUsage* +gundo.txt gundo.txt /*gundo.txt* diff --git a/.vim/bundle/gundo.vim/plugin/gundo.vim b/.vim/bundle/gundo.vim/plugin/gundo.vim new file mode 100644 index 0000000..c6a7c37 --- /dev/null +++ b/.vim/bundle/gundo.vim/plugin/gundo.vim @@ -0,0 +1,795 @@ +" ============================================================================ +" File: gundo.vim +" Description: vim global plugin to visualize your undo tree +" Maintainer: Steve Losh +" License: GPLv2+ -- look it up. +" Notes: Much of this code was thiefed from Mercurial, and the rest was +" heavily inspired by scratch.vim and histwin.vim. +" +" ============================================================================ + + +"{{{ Init +"if exists('loaded_gundo') || &cp + "finish +"endif + +"let loaded_gundo = 1 + +if !exists('g:gundo_width') + let g:gundo_width = 45 +endif +"}}} + +"{{{ Movement Mappings +function! s:GundoMove(direction) + let start_line = getline('.') + + " If we're in between two nodes we move by one to get back on track. + if stridx(start_line, '[') == -1 + let distance = 1 + else + let distance = 2 + endif + + let target_n = line('.') + (distance * a:direction) + + " Bound the movement to the graph. + if target_n <= 4 + call cursor(5, 0) + else + call cursor(target_n, 0) + endif + + let line = getline('.') + + " Move to the node, whether it's an @ or an o + let idx1 = stridx(line, '@') + let idx2 = stridx(line, 'o') + if idx1 != -1 + call cursor(0, idx1 + 1) + else + call cursor(0, idx2 + 1) + endif + + let target_line = matchstr(getline("."), '\v\[[0-9]+\]') + let target_num = matchstr(target_line, '\v[0-9]+') + call s:GundoRenderPreview(target_num) +endfunction +"}}} + +"{{{ Buffer/Window Management +function! s:GundoResizeBuffers(backto) + " This sucks and doesn't work. TODO: Fix it. + exe bufwinnr(bufnr('__Gundo__')) . "wincmd w" + exe "vertical resize " . g:gundo_width + exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w" + exe "resize " . 15 + exe a:backto . "wincmd w" +endfunction + +function! s:GundoOpenBuffer() + let existing_gundo_buffer = bufnr("__Gundo__") + + if existing_gundo_buffer == -1 + exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w" + exe "new __Gundo__" + call s:GundoResizeBuffers(winnr()) + nnoremap