{"thread":{"id":"59037","subject":"mergetools: wrong window selected for vimdiff1","startedAt":"2023-01-05T18:56:14Z","lastAt":"2023-01-05T18:56:14Z","messageCount":1,"participants":["Sebastián Mancilla"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"469812","messageId":"167294445271.7.3739319158947040124.89448053@smancill.dev","threadId":"59037","inReplyTo":null,"subject":"mergetools: wrong window selected for vimdiff1","fromName":"Sebastián Mancilla","fromEmail":"smancill@smancill.dev","sentAt":"2023-01-05T18:47:15Z","receivedAt":"2023-01-05T18:56:14Z","isPatch":false,"sender":{"key":"smancill@smancill.dev","avatar":null},"body":"The layout for the vimdiff1 mergetool is \"@LOCAL,REMOTE\". From the man page:\n\n    o   layout = \"@LOCAL,REMOTE\"\n\n        When MERGED is not present in the layout, you must \"mark\" one\n        of the buffers with an asterisk. That will become the buffer\n        you need to edit and save after resolving the conflicts.\n\n            ------------------------------------------\n            |                   |                    |\n            |                   |                    |\n            |                   |                    |\n            |     LOCAL         |    REMOTE          |\n            |                   |                    |\n            |                   |                    |\n            |                   |                    |\n            ------------------------------------------\n\nBut after opening the buffers, the cursor is in the *right window*.\n\nThis is confusing, since it makes you think the right buffer is the one that\nneeds to be edited, instead of the left one.\n\nDebug output (the make-conflicts.sh script in this repository [0] can be used\nto quickly test a file with conflicts):\n\n    Merging:\n    poem.txt\n\n    Normal merge conflict for 'poem.txt':\n      {local}: modified file\n        {remote}: modified file\n\n        LAYOUT    : @LOCAL,REMOTE\n        CMD       : echo\n        NESTED MIN: 0\n        CLEAN     : @LOCAL,REMOTE\n\n        LAYOUT    : @LOCAL\n        CMD       : echo | leftabove vertical split\n        NESTED MIN: 0\n        CLEAN     : @LOCAL\n\n        LAYOUT    : REMOTE\n        CMD       : echo | leftabove vertical split | 1b | wincmd l\n        NESTED MIN: 0\n        CLEAN     : REMOTE\n\n        FINAL CMD : -c \"set hidden diffopt-=hiddenoff | echo |\nleftabove vertical split | 1b | wincmd l | 3b | execute 'tabdo windo\ndiffthis' | tabfirst\"\n        FINAL TAR : LOCAL\n        4 files to edit\n\nAlso note that when vimdiff1 was introduced by 30bb8088af\n(mergetools/vimdiff: add\nvimdiff1 merge tool variant, 2021-02-13), Vim echoed a nice message to\nremember which buffer shall be edited:\n\n> +        *vimdiff1)\n> +                \"$merge_tool_path\" -f -d \\\n> +                        -c 'echon \"Resolve conflicts leftward then save. Use :cq to abort.\"' \\\n> +                        \"$LOCAL\" \"$REMOTE\"\n\nBut with the refactor done by 0041797449 (vimdiff: new implementation with\nlayout support, 2022-03-30), now the message is gone:\n\n>          *vimdiff1)\n> -                \"$merge_tool_path\" -f -d \\\n> -                        -c 'echon \"Resolve conflicts leftward then save. Use :cq to abort.\"' \\\n> -                        \"$LOCAL\" \"$REMOTE\"\n> -                ret=\"$?\"\n> -                if test \"$ret\" -eq 0\n> -                then\n> -                        cp -- \"$LOCAL\" \"$MERGED\"\n> -                fi\n> -                return \"$ret\"\n> +                layout=\"@LOCAL,REMOTE\"\n>                  ;;\n\n\n[0]: https://github.com/whiteinge/diffconflicts/tree/master/_utils\n\n-- \nSebastián Mancilla\n\n"}]}