# HG changeset patch # User Steve Losh # Date 1286636966 14400 # Node ID 725085a34b62668111b833b4f11020fdc4834a3c # Parent 2513c9fd4319880718f2b02e2551b28cc74a41dd Restructure everything and add fold markers before I go insane. diff -r 2513c9fd4319 -r 725085a34b62 plugin/gundo.vim --- a/plugin/gundo.vim Sat Oct 09 09:38:04 2010 -0400 +++ b/plugin/gundo.vim Sat Oct 09 11:09:26 2010 -0400 @@ -4,11 +4,12 @@ " 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. +" heavily inspired by scratch.vim and histwin.vim. " " ============================================================================ -" -" + + +"{{{ Init "if exists('loaded_gundo') || &cp "finish "endif @@ -18,7 +19,9 @@ if !exists('g:gundo_width') let g:gundo_width = 45 endif +"}}} +"{{{ Movement Mappings function! s:GundoMoveUp() call cursor(line('.') - 2, 0) @@ -30,6 +33,8 @@ else call cursor(0, idx2 + 1) endif + + call s:GundoRenderPreview() endfunction function! s:GundoMoveDown() @@ -43,6 +48,18 @@ else call cursor(0, idx2 + 1) endif + + call s:GundoRenderPreview() +endfunction +"}}} + +"{{{ Buffer/Window Management +function! s:GundoResizeBuffers(backto) + exe bufwinnr(bufwinnr('__Gundo__')) . "wincmd w" + exe "vertical resize " . g:gundo_width + exe bufwinnr(bufwinnr('__Gundo_Preview__')) . "wincmd w" + exe "vertical resize " . 40 + exe a:backto . "wincmd w" endfunction function! s:GundoOpenBuffer() @@ -51,7 +68,7 @@ if existing_gundo_buffer == -1 exe "vnew __Gundo__" wincmd H - exe "vertical resize " . g:gundo_width + call s:GundoResizeBuffers(winnr()) nnoremap