731f1e6565c4

Add g:gundo_preview_bottom option
[view raw] [browse files]
author Randy Morris <randy.morris@rsontech.net>
date Wed, 27 Oct 2010 19:09:02 -0400
parents 4ad278a555cf
children 903d37063c3d
branches/tags (none)
files doc/gundo.txt plugin/gundo.vim

Changes

--- a/doc/gundo.txt	Wed Oct 20 21:24:17 2010 -0400
+++ b/doc/gundo.txt	Wed Oct 27 19:09:02 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	Wed Oct 20 21:24:17 2010 -0400
+++ b/plugin/gundo.vim	Wed Oct 27 19:09:02 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"}}}
@@ -542,6 +545,13 @@
     if existing_gundo_buffer == -1
         exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
         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)
@@ -552,7 +562,15 @@
             endif
         else
             exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
-            exe "split +buffer" . existing_gundo_buffer
+            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
@@ -562,12 +580,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)
@@ -577,12 +597,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