{"thread":{"id":"58139","subject":"vimdiff mergetool diff mode detection in vimrc broken by commit 0041797449","startedAt":"2022-07-12T00:06:34Z","lastAt":"2022-07-12T05:56:32Z","messageCount":2,"participants":["Andrew Oates","Fernando Ramos"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"458842","messageId":"CAAVLcG42wom6Rf=6YZoc+iUnXDxshBfGOjqQPryGkzXxRxb-hA@mail.gmail.com","threadId":"58139","inReplyTo":null,"subject":"vimdiff mergetool diff mode detection in vimrc broken by commit 0041797449","fromName":"Andrew Oates","fromEmail":"andrew@andrewoates.com","sentAt":"2022-07-12T00:06:12Z","receivedAt":"2022-07-12T00:06:34Z","isPatch":false,"sender":{"key":"andrew@andrewoates.com","avatar":null},"body":"Hi all,\n\nI believe commit 0041797449da61f4131bb1673fa5d4c3af48240d (\"vimdiff:\nnew implementation with layout support\") broke the ability to detect\ndiff mode in a .vimrc, because it removed '-d' from the command line\nuse to invoke vim ('&diff' evaluates to false, because diffmode isn't\nenabled until the commands are run, which happens _after_ vimrc is\nexecuted AFAICT).  I check &diff in my vimrc to set various settings\nspecifically when doing a diff/merge.\n\nJust adding '-d' back breaks the layouts unfortunately. I can hack\naround this with a heuristic that looks for a mergetool-like\ninvocation, but ideally there would be a way to set the canonical diff\nsetting correctly.  It may be as simple as adding some extra commands\nto close the extra windows opened by adding '-d'.\n\nThoughts?\n\nCheers,\nAndrew\n"},{"id":"458846","messageId":"Ys0NBXe76q6Ls6OI@zacax395.localdomain","threadId":"58139","inReplyTo":"CAAVLcG42wom6Rf=6YZoc+iUnXDxshBfGOjqQPryGkzXxRxb-hA@mail.gmail.com","subject":"Re: vimdiff mergetool diff mode detection in vimrc broken by commit 0041797449","fromName":"Fernando Ramos","fromEmail":"greenfoo@u92.eu","sentAt":"2022-07-12T05:56:21Z","receivedAt":"2022-07-12T05:56:32Z","isPatch":false,"sender":{"key":"greenfoo@u92.eu","avatar":"https://avatars.githubusercontent.com/u/42691086?v=4"},"body":"> I check &diff in my vimrc to set various settings specifically when doing a\n> diff/merge.\n\nHi Andrew, could using an auto command on the \"DiffUpdated\" event work for you?\n\nExample: add this to .vimrc:\n\n    au DiffUpdated * if &diff | colorscheme darkblue | endif\n\nThis function will be executed every time \"diff mode\" is updated in any way and\nseems to work both when running vimdiff directly and when entering diff mode\ninteractively (as it is the case now when running \"git mergetool\").\n\nIt has the added benefit that you can also use this same \"trick\" to toggle the\nsettings off when *exiting* diff mode:\n\n    au DiffUpdated * if !&diff | colorscheme desert | endif\n\nLet me know if this is enough for your use case.\n\nThanks!\n\n"}]}