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

Re: [PATCH v3 7/7] mergetools: vimdiff: restore selective diff mode

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Aug 9, 2022, 01:08 UTC
Message-ID
<CAMP44s2RsvXnt8LtDcv+Ai_kCxmtURGWXmwfchO08dhjMxkGhA@mail.gmail.com>
In-Reply-To
<20220809004549.123020-8-felipe.contreras@gmail.com>

On Mon, Aug 8, 2022 at 7:46 PM Felipe Contreras <felipe.contreras@gmail.com> wrote:

>
> Apparently some people want the diff mode to show differences only on
> the visible windows, so turn this on only when the tab has more than one
> window.
Show 23 quoted lines
> @@ -323,8 +323,20 @@ gen_cmd () {
>         IFS=+
>         for tab in $LAYOUT
>         do
> -               test -n "$CMD" && CMD="$CMD | tabnew | silent execute 'bufdo diffthis'"
> -               CMD=$(gen_cmd_aux "$tab" "$CMD")
> +               if echo "$tab" | grep ",\|/" >/dev/null
> +               then
> +                       test -n "$CMD" && CMD="$CMD | tabnew"
> +                       CMD=$(gen_cmd_aux "$tab" "$CMD")
> +                       CMD="$CMD | execute 'windo diffthis'"
> +               else
> +                       if test -z "$CMD"
> +                       then
> +                               CMD="silent execute 'bufdo diffthis'"
> +                       else
> +                               CMD="$CMD | tabnew | silent execute 'bufdo diffthis'"
> +                       fi
> +                       CMD=$(gen_cmd_aux "$tab" "$CMD")
> +               fi
>         done
>         IFS=$oldIFS
>
Notice that after reorganizing the tab handling my layout becomes really simple:
  set hidden diffopt-=hiddenoff | silent execute 'bufdo diffthis' | 4b
And your layout becomes:
  set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 2b
| wincmd l | 1b | execute 'windo diffthis' | tabnew | leftabove
vertical split | 2b | wincmd l | 3b | execute 'windo diffthis'
So this "works" too, right?
Cheers.
-- 
Felipe Contreras
Previous: Felipe ContrerasNext: Fernando Ramos
Message 9 of 13 in “mergetools: vimdiff: regression fixes and improvements”
  1. 0/7 mergetools: vimdiff: regression fixes and improvementsFelipe Contreras, Aug 9, 2022
  2. 1/7 mergetools: vimdiff: fix commentFelipe Contreras, Aug 9, 2022
  3. 2/7 mergetools: vimdiff: make vimdiff3 actually workFelipe Contreras, Aug 9, 2022
  4. 3/7 mergetools: vimdiff: silence annoying messagesFelipe Contreras, Aug 9, 2022
  5. 4/7 mergetools: vimdiff: fix for diffoptFelipe Contreras, Aug 9, 2022
  6. 6/7 mergetools: vimdiff: rework tab logicFelipe Contreras, Aug 9, 2022
  7. 5/7 mergetools: vimdiff: fix single window layoutsFelipe Contreras, Aug 9, 2022
  8. 7/7 mergetools: vimdiff: restore selective diff modeFelipe Contreras, Aug 9, 2022
  9. Felipe ContrerasAug 9, 2022
  10. Fernando RamosAug 9, 2022
  11. Felipe ContrerasAug 9, 2022
  12. Junio C HamanoAug 10, 2022
  13. Junio C HamanoAug 10, 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.