Subject: Re: [PATCH v6 1/3] vimdiff: new implementation with layout support

From: Philippe Blain <[email-masked]>
Date: Sun, 27 Mar 2022 12:47:57 -0400

Hi Fernando,

Le 2022-03-27 à 07:23, Fernando Ramos a écrit :

--8<--

> +################################################################################
> +## Internal functions (not meant to be used outside this script)
> +################################################################################
> +
> +debug_print () { 
> +	# Send message to stderr if global variable DEBUG is set to "true"

This should also be GIT_MERGETOOL_VIMDIFF_DEBUG, right?

> +
> +	if test -n "$GIT_MERGETOOL_VIMDIFF_DEBUG"
> +	then
> +		>&2 echo "$@"
> +	fi
> +}
> +

--8<--

> +gen_cmd () {
> +	# This function returns (in global variable FINAL_CMD) the string that
> +	# you can use when invoking "vim" (as shown next) to obtain a given
> +	# layout:
> +	#
> +	#   $ vim -f $FINAL_CMD "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
> +	#
> +	# It takes one single argument: a string containing the desired layout
> +	# definition.
> +	#
> +	# The syntax of the "layout definitions" is explained in ... (TODO)...

Is this still TODO ?

> +	# but you can already intuitively understand how it works by knowing
> +	# that...
> +	#
> +	#   * ";" means "a new vim tab"
> +	#   * "-" means "a new vim horizontal split"
> +	#   * "|" means "a new vim vertical split"
> +	#
> +	# It also returns (in global variable FINAL_TARGET) the name ("LOCAL",
> +	# "BASE", "REMOTE" or "MERGED") of the file that is marked with an "@",
> +	# or "MERGED" if none of them is.
> +	#
> +	# Example:
> +	#
> +	#     gen_cmd "@LOCAL , REMOTE"
> +	#     |
> +	#     `-> FINAL_CMD    == "-c \"echo | vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
> +	#         FINAL_TARGET == "LOCAL"