903d37063c3d

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 28 Oct 2010 20:42:03 -0400
parents 2d3ac23e7413 (current diff) 731f1e6565c4 (diff)
children dea2a7d1649e
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/doc/gundo.txt	Thu Oct 28 20:16:09 2010 -0400
+++ b/doc/gundo.txt	Thu Oct 28 20:42:03 2010 -0400
@@ -19,7 +19,8 @@
     3. Configuration .................. |GundoConfig|
         3.1 gundo_width ............... |gundo_width|
         3.2 gundo_preview_height ...... |gundo_preview_height|
-        3.2 gundo_right ............... |gundo_right|
+        3.3 gundo_preview_bottom ...... |gundo_preview_bottom|
+        3.4 gundo_right ............... |gundo_right|
     4. License ........................ |GundoLicense|
     5. Bugs ........................... |GundoBugs|
     6. Contributing ................... |GundoContributing|
@@ -136,7 +137,24 @@
 Default: 15
 
 ------------------------------------------------------------------------------
-3.3 g:gundo_right                                                *gundo_right*
+3.3 g:gundo_preview_bottom                              *gundo_preview_bottom*
+
+Force the preview window below current windows instead of below the graph.
+This gives the preview window more space to show the unified diff.
+
+Example:
+
+   +--------+            +--------+
+   !g!      !            !      !g!
+   !g!      !     or     !      !g!
+   !g!______!            !______!g!
+   !g!pppppp!            !pppppp!g!
+   +--------+            +--------+
+
+Default: 0
+
+------------------------------------------------------------------------------
+3.4 g:gundo_right                                                *gundo_right*
 
 Set this to 1 to make the Gundo graph (and preview) open on the right side
 instead of the left.
--- a/plugin/gundo.vim	Thu Oct 28 20:16:09 2010 -0400
+++ b/plugin/gundo.vim	Thu Oct 28 20:42:03 2010 -0400
@@ -48,6 +48,9 @@
 if !exists('g:gundo_preview_height')"{{{
     let g:gundo_preview_height = 15
 endif"}}}
+if !exists('g:gundo_preview_bottom')"{{{
+    let g:gundo_preview_bottom = 0
+endif"}}}
 if !exists('g:gundo_right')"{{{
     let g:gundo_right = 0
 endif"}}}
@@ -583,8 +586,15 @@
     let existing_gundo_buffer = bufnr("__Gundo__")
 
     if existing_gundo_buffer == -1
-        exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
+        call s:GundoGoToWindowForBufferName('__Gundo_Preview__')
         exe "new __Gundo__"
+        if g:gundo_preview_bottom
+            if g:gundo_right
+                wincmd L
+            else
+                wincmd H
+            endif
+        endif
         call s:GundoResizeBuffers(winnr())
     else
         let existing_gundo_window = bufwinnr(existing_gundo_buffer)
@@ -594,8 +604,16 @@
                 exe existing_gundo_window . "wincmd w"
             endif
         else
-            exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
-            exe "split +buffer" . existing_gundo_buffer
+            call s:GundoGoToWindowForBufferName('__Gundo_Preview__')
+            if g:gundo_preview_bottom
+                if g:gundo_right
+                    exe "botright vsplit +buffer" . existing_gundo_buffer
+                else
+                    exe "topleft vsplit +buffer" . existing_gundo_buffer
+                endif
+            else
+                exe "split +buffer" . existing_gundo_buffer
+            endif
             call s:GundoResizeBuffers(winnr())
         endif
     endif
@@ -605,12 +623,14 @@
     let existing_preview_buffer = bufnr("__Gundo_Preview__")
 
     if existing_preview_buffer == -1
-        exe "vnew __Gundo_Preview__"
-
-        if g:gundo_right
-            wincmd L
+        if g:gundo_preview_bottom
+            exe "botright new __Gundo_Preview__"
         else
-            wincmd H
+            if g:gundo_right
+                exe "botright vnew __Gundo_Preview__"
+            else
+                exe "topleft vnew __Gundo_Preview__"
+            endif
         endif
     else
         let existing_preview_window = bufwinnr(existing_preview_buffer)
@@ -620,12 +640,14 @@
                 exe existing_preview_window . "wincmd w"
             endif
         else
-            exe "vsplit +buffer" . existing_preview_buffer
-
-            if g:gundo_right
-                wincmd L
+            if g:gundo_preview_bottom
+                exe "botright split +buffer" . existing_preview_buffer
             else
-                wincmd H
+                if g:gundo_right
+                    exe "botright vsplit +buffer" . existing_preview_buffer
+                else
+                    exe "topleft vsplit +buffer" . existing_preview_buffer
+                endif
             endif
         endif
     endif
@@ -889,7 +911,9 @@
         return
 
     target_n = int(vim.eval('s:GundoGetTargetState()'))
-    back = int(vim.eval('bufwinnr(g:gundo_target_n)'))
+    back = int(vim.eval('g:gundo_target_n'))
+
+    vim.command('echo "%s"' % back)
 
     _goto_window_for_buffer(back)
     normal('zR')