fourjay / vcscommand

Automatically exported from code.google.com/p/vcscommand
0 stars 0 forks source link

[PATCH] Avoid :VCSAnnotate! window nesting when doing further annotates. #80

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When mining the revision history through multiple invocations of :VCSAnnotate! 
(the bang-version that splits annotation and source code in two windows), the 
next annotation is opened in a (vertical/horizontal) split. Already on the 
second :VCSAnnotation, the new window-combo is so small that it's of no use 
(because the :split is done based on the originating window's width / height). 

+----------------------+
|orig                  |
+-----+----------------+
|head |src             |
+-----|                |
|h2|s2|                |
+-----+----------------+

Instead, subsequent :VCSAnnotate! commands should always open in a full-width 
split below the current annotate window-combo, so that the annotation history 
becomes a neat stack of windows. (Vertical splitting with the two-window 
vertical combo doesn't make any sense to me, so it's always horizontal.) 

+----------------------+
|orig                  |
+-----+----------------+
|head |src             |
+-----+----------------+
|head2|src2            |
+-----+----------------+

See attached patch. It's a little cumbersome to get the new split mode down to 
the right function, but fortunately, you have already provided a mechanism with 
the option override. 

-- regards, ingo

Original issue reported on code.google.com by sw...@ingo-karkat.de on 30 Jul 2011 at 2:10

Attachments:

GoogleCodeExporter commented 8 years ago
Would the following change support your need?

diff --git a/plugin/vcscommand.vim b/plugin/vcscommand.vim
index 1ea79b6..260cb60 100644
--- a/plugin/vcscommand.vim
+++ b/plugin/vcscommand.vim
@@ -818,6 +818,7 @@ function! s:VCSAnnotate(bang, ...)
                        if splitRegex == ''
                                return annotateBuffer
                        endif
+                       wincmd J
                        let originalFileType = getbufvar(originalBuffer, '&ft')
                        let annotateFileType = getbufvar(annotateBuffer, '&ft')

Original comment by bob.hies...@gmail.com on 30 Nov 2011 at 8:44

GoogleCodeExporter commented 8 years ago
Yes, that seems to be equivalent to what I did in a more clumsy way :-)

PS: I'm currently cloning your Git repo on http://repo.or.cz/w/vcscommand.git 
to simplyfy further collaboration (I have a couple more patches and ideas in 
the queue), and I noticed that the repo only contains version v1.99.44, not the 
v1.99.45 changes that you published on vim.org. Did you forget to push?

Original comment by sw...@ingo-karkat.de on 1 Dec 2011 at 10:20

GoogleCodeExporter commented 8 years ago
Yes, I did indeed forget to push.

Regarding this change, I'll push it out once I decide whether to make this an 
option, always-on, and maybe even make it more general (probably apply it to 
VCSVimDiff, at least).  Any thoughts?

Original comment by bob.hies...@gmail.com on 5 Dec 2011 at 4:23

GoogleCodeExporter commented 8 years ago
I don't fully follow you on the option, but I would appreciate an option in 
VCSVimDiff to open the other file (often the predecessor) to the left. So far, 
I'm replacing "vert rightbelow split" with "vert split" in s:EditFile. 

Original comment by sw...@ingo-karkat.de on 5 Dec 2011 at 4:53

GoogleCodeExporter commented 8 years ago
This is released as 1.99.46.

Original comment by bob.hies...@gmail.com on 6 Dec 2011 at 5:41