Re: [PATCH v6 1/3] vimdiff: new implementation with layout support
Hi Fernando,
Le 2022-03-27 à 07:23, Fernando Ramos a écrit :
--8<--
Show 6 quoted lines
> +################################################################################
> +## 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?
Show 7 quoted lines
> +
> + if test -n "$GIT_MERGETOOL_VIMDIFF_DEBUG"
> + then
> + >&2 echo "$@"
> + fi
> +}
> +
Show 11 quoted lines
> +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)...Show 17 quoted lines
> + # 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"