From 3f7226297daf192480044236ddf183936028fe15 Mon Sep 17 00:00:00 2001 From: Randy Morris Date: Wed, 27 Oct 2010 19:09:02 -0400 Subject: [PATCH] Add g:gundo_preview_bottom option --- doc/gundo.txt | 22 ++++++++++++++++++++-- plugin/gundo.vim | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/doc/gundo.txt b/doc/gundo.txt index 2ee75a0..77919eb 100644 --- a/doc/gundo.txt +++ b/doc/gundo.txt @@ -19,7 +19,8 @@ CONTENTS *Gundo-contents* 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 @@ Set the vertical height of the Gundo preview. 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. diff --git a/plugin/gundo.vim b/plugin/gundo.vim index ed08ea9..6f51fd3 100644 --- a/plugin/gundo.vim +++ b/plugin/gundo.vim @@ -48,6 +48,9 @@ endif"}}} 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 @@ function! s:GundoOpenGraph()"{{{ 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 @@ function! s:GundoOpenGraph()"{{{ 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 @@ function! s:GundoOpenPreview()"{{{ 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 @@ function! s:GundoOpenPreview()"{{{ 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