From: Fernando Ramos <greenfoo@u92.eu>
To: Junio C Hamano <gitster@pobox.com>
Cc: David Aguilar <davvid@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Seth House <seth@eseth.com>,
levraiphilippeblain@gmail.com, rogi@skylittlesystem.org
Subject: Re: [RFC PATCH] mergetools/vimdiff: add vimdiff4 merge tool variant
Date: Mon, 25 Oct 2021 22:13:30 +0200 [thread overview]
Message-ID: <YXcP6kf3tGr+WFRS@zacax395.localdomain> (raw)
In-Reply-To: <xmqqk0i10xzt.fsf@gitster.g>
Thanks David and Juno for your feedback.
I completely agree that adding another vimdiffX variant is ... not elegant.
So I've been thinking a bit more about how this whole "vim layout" mechanism can
be made more generic and this is what I came up with:
1. Let's add a new configuration variable to the "vimdiff" merge tool called
"layout":
[mergetool "vimdiff"]
layout = ...
2. If this new variable is *not* present, vim will behave in the same way it
does today (ie. a top row with the local, base and remote buffers, and a
bottom row with the merged buffer).
3. In all other cases, the contents of the "layout" variable will be
intepreted following these rules:
- ";" is used to separate "tab descriptors"
- "," is used to separate "row descriptors"
- "|" is used to separate "column descriptors"
- "+" is used to load buffers that won't be displayed by default
This will be better understood with some examples that emulate the behavior
of the current "vimdiff", "vimdiff1", "vimdiff2" and "vimdiff3" variants as
well as the proposed "vimdiff4" one:
vimdiff --> layout = "LOCAL | BASE | REMOTE, MERGED"
------------------------------------------
| | | |
| LOCAL | BASE | REMOTE |
| | | |
------------------------------------------
| |
| MERGED |
| |
------------------------------------------
vimdiff1 --> layout = "LOCAL* | REMOTE"
------------------------------------------
| | |
| | |
| | |
| LOCAL | REMOTE |
| | |
| | |
| | |
------------------------------------------
NOTE: In this case (where there is no "MERGED"
buffer specified in the "layout" string), a "*"
is needed to indicate which file will be the one
containing the final version of the file after
resolving conflicts.
vimdiff2 --> layout = "LOCAL | MERGED | REMOTE"
------------------------------------------
| | | |
| | | |
| | | |
| LOCAL | BASE | REMOTE |
| | | |
| | | |
| | | |
| | | |
------------------------------------------
vimdiff3 --> layout = "LOCAL + REMOTE + BASE + MERGED"
------------------------------------------
| |
| |
| |
| MERGED |
| |
| |
| |
------------------------------------------
NOTE: LOCAL, REMOTE and BASE are loaded as hidden
buffers and you need to recall them explicitely.
vimdiff4 --> layout = "BASE | LOCAL | REMOTE, MERGED; BASE | LOCAL; BASE | REMOTE"
------------------------------------------
| <TAB #1> | TAB #2 | TAB #3 | |
------------------------------------------
| | | |
| LOCAL | BASE | REMOTE |
| | | |
------------------------------------------
| |
| MERGED |
| |
------------------------------------------
------------------------------------------
| TAB #1 | <TAB #2> | TAB #3 | |
------------------------------------------
| | |
| | |
| | |
| BASE | LOCAL |
| | |
| | |
| | |
------------------------------------------
------------------------------------------
| TAB #1 | TAB #2 | <TAB #3> | |
------------------------------------------
| | |
| | |
| | |
| BASE | REMOTE |
| | |
| | |
| | |
------------------------------------------
The nice thing about this approach is that, as we have seen, it is generic
enough to rule all current variants obsolete.
So, please let me know what you think about this:
* Do you like this approach? Or am I trying to crack a nut with a sledgehammer
by making the whole thing too complex?
* In case you like it, should we keep the old "vimdiff1", "vimdiff2" and
"vimdiff3" variants for backwards compatibility?
If the answer is "yes", I'll just alias them to the new "layout" mechanism
so that the amount of extra code needed for supporting them is minimal.
If you tell me you like this proposal, I'll go ahead and implement a patch for
all of this, taking into consideration David's suggestions for avoiding problems
with file with spaces in their names and also adding new documentation for all
of this.
NOTE: The only non-trivial thing about implementing this is how to parse the
"layout" variable syntax *in bash* to convert it into a sequence of vim
commands that achieves the expected outcome... but seems like a funny
weekend project :)
If you think it is not worth the effort, let me know if it is OK to just add
"vimdiff4" + documentation instead for now (or something else).
Thanks.
next prev parent reply other threads:[~2021-10-25 20:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 21:20 [RFC PATCH] mergetools/vimdiff: add vimdiff4 merge tool variant Fernando Ramos
2021-10-19 22:12 ` Fernando Ramos
2021-10-24 22:54 ` David Aguilar
2021-10-25 18:18 ` Junio C Hamano
2021-10-25 20:13 ` Fernando Ramos [this message]
2021-10-27 16:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXcP6kf3tGr+WFRS@zacax395.localdomain \
--to=greenfoo@u92.eu \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=levraiphilippeblain@gmail.com \
--cc=rogi@skylittlesystem.org \
--cc=seth@eseth.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).