4

After looking at the great vimcast-series about fugitive I have tried to use it for a while. But I have some strangeness going on. So here is one question:

When I have a merge conflict and open the file I get the layout

----------------------------
|        |         |       |
| target | working | merge |
| (HEAD) |  copy   |       |
|        |         |       |
----------------------------

When I then try to view the status with :Gstatus I get:

----------------------------
|        | status  |       |
| target |---------| merge |
| (HEAD) | working |       |
|        |  copy   |       |
----------------------------

instead of the expected:

----------------------------
|          status          |
|--------------------------|
| target | working | merge |
| (HEAD) |  copy   |       |
----------------------------

What can I do to find out what’s wrong and how do I fix it?

UlfR
  • 4,175
  • 29
  • 45

2 Answers2

4

The :Gstatus command uses the preview window, and that is opened (as with :pedit) as a plain above split. If you have vertical splits, the preview window will be restricted to the current window column (as you illustrate in your question).

I don't know where your expectations come from, but you could ask fugitive's maintainer to open the preview window (if it doesn't exist yet) with :topleft pedit, to get the behavior you want. To work around the issue, open the preview window at the right location before :Gstatus, or correct the layout afterwards with :wincmd K or <C-w>K.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • 1
    The expectations comes from watching the vimcast-video that I linked to. – UlfR Jun 25 '14 at 12:36
  • I ended up using your idea to making a map that does this for me: `nmap gs :GstatuskKp`. (`:Gstatus` to open the status, `k` to move up to the status buffer, `K` to correct the layout, and `p` to move back to the previous buffer). @kalbasit's solution would be more complete, but this oneline works for me since I wouldn't have any reason to type `:Gstatus` instead of a mapping. – redbmk Jun 29 '16 at 15:37
1
set previewheight=15
au BufEnter ?* call PreviewHeightWorkAround()
func PreviewHeightWorkAround()
  if &previewwindow
    exec 'wincmd K'
    exec 'setlocal winheight='.&previewheight
  endif
endfunc

This has worked for me to achieve exactly what you're looking for.

Source: https://stackoverflow.com/a/3787326/301730

Community
  • 1
  • 1
kalbasit
  • 766
  • 8
  • 17