git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug with splits in new nvimdiff layout

From
MKMatthew Klein <mklein994@gmail.com>
Date
Jul 7, 2022, 16:58 UTC
Message-ID
<CACRpdvnuAYY0U1_3uD8zKgtq05+bgwjzXpZKomro6gqYDNrjGg@mail.gmail.com>
Hi,
I encountered a bug when using the new vimdiff layout format.
To recreate this, start with a merge conflict, and merge with this command:
    git mergetool --tool=nvimdiff
I expected the layout to be:
    ------------------------------------------
    |             |           |              |
    |   LOCAL     |   BASE    |   REMOTE     |
    |             |           |              |
    ------------------------------------------
    |                                        |
    |                MERGED                  |
    |                                        |
    ------------------------------------------
The layout when I ran the command was:
    ------------------------------------------
    |                                        |
    |                LOCAL                   |
    |                                        |
    ------------------------------------------
    |             |           |              |
    |   LOCAL     |   LOCAL   |   MERGED     |
    |             |           |              |
    ------------------------------------------

I expected the layout to be the same as what was documented to be the default for "nvimdiff".

In my init.vim configuration file, I have these lines set:
    set splitbelow
    set splitright

These options globally change the behaviour of the "split" command so that instead of "split" creating a new window above the current window, or to the left when used with "vertical", it does the opposite. Docs: https://neovim.io/doc/user/options.html#'splitbelow'

I recommend using the "leftabove" (a.k.a "aboveleft") command together with
"split". Since these windows are positioned absolutely (according to
"mergetool.nvimdiff.layout"), it shouldn't depend on the user's configuration.
Docs: https://neovim.io/doc/user/windows.html#:leftabove

The previous invocation (i.e. "4wincmd w | wincmd J") didn't run into this issue, since its not affected by the "splitbelow" and "splitright" options.

Hope this helps,
Matthew

[System Info] git version: git version 2.37.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.18.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 02 Jul 2022 21:03:06 +0000 x86_64 compiler info: gnuc: 12.1 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]
Next: Junio C Hamano
Message 1 of 3 in “Bug with splits in new nvimdiff layout”
  1. Matthew KleinJul 7, 2022
  2. Junio C HamanoJul 7, 2022
  3. Fernando RamosJul 8, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.