Felipe Contreras wrote:

> Nowadays most people use the unified diff, which has this format:
> 
>   --- a/foo
>   +++ b/foo
> 
> In that case the old file starts with '---', but currently that's
> considered the new file, since the old context format is like:
> 
>   *** a/foo
>   --- b/foo
> 
> Let's use the modern format by default, and leave the option for users
> to use the old format with `diff_context = 1`.
> 
> Signed-off-by: Felipe Contreras <[email protected]>
> ---
>  runtime/syntax/diff.vim | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim
> index b656cd97a..b9e5131e0 100644
> --- a/runtime/syntax/diff.vim
> +++ b/runtime/syntax/diff.vim
> @@ -346,11 +346,15 @@ syn match diffLine      "^---$"
>  syn match diffLine   "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
>  
>  syn match diffFile   "^diff\>.*"
> -syn match diffFile   "^+++ .*"
>  syn match diffFile   "^Index: .*"
>  syn match diffFile   "^==== .*"
> -syn match diffOldFile        "^\*\*\* .*"
> -syn match diffNewFile        "^--- .*"
> +if !exists("diff_context")
> +     syn match diffOldFile   "^--- .*"
> +     syn match diffNewFile   "^+++ .*"
> +else
> +     syn match diffOldFile   "^\*\*\* .*"
> +     syn match diffNewFile   "^--- .*"
> +end
>  
>  " Used by git
>  syn match diffIndexLine      "^index \x\x\x\x.*"

I do not see a reason to omit highlighting +++, in a context diff you
would not find them.

Your patch makes the name more accurate, but at the same time makes it
more complicated.  If you don't mind the name for the highlight group,
it just works already.

-- 
ARTHUR:          But if he was dying, he wouldn't bother to carve
                 "Aaaaarrrrrrggghhh".  He'd just say it.
BROTHER MAYNARD: It's down there carved in stone.
GALAHAD:         Perhaps he was dictating.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012061751.0B6HpBgM1140025%40masaka.moolenaar.net.

Raspunde prin e-mail lui