]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0016: default diff highlighting is too noisy v9.1.0016
authorRomain Lafourcade <romain.lafourcade@razorfish.fr>
Sun, 7 Jan 2024 14:08:31 +0000 (15:08 +0100)
committerChristian Brabandt <cb@256bit.org>
Sun, 7 Jan 2024 22:32:19 +0000 (23:32 +0100)
Problem:  default diff highlighting is too noisy
Solution: Link diff highlighting groups to new
          Added/Removed/Changed, revert previous change
          (Romain Lafourcade)

Remove diff* links added in #13776 and doc added in commit b1392be

The links added in #13776 are way too noisy for the contexts in which
the `diff` syntax is applied (git commits, patches, etc.).

This commit:

- removes those links
- adds new default highlighting groups Added, Changed and
  Removed
- links the diff highlighting groups to those new defaults
- removes the doc changes
- adjusts the syntax_completion test for those newly added group
  names

Note: Changes to the default color schemes will be handled separately,
by adding links to those newly created Added/Removed/Changed
highlighting groups.

related: #13776
closes #13825

Signed-off-by: Romain Lafourcade <romain.lafourcade@razorfish.fr>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/syntax.txt
runtime/doc/tags
runtime/syntax/diff.vim
runtime/syntax/help.vim
runtime/syntax/syncolor.vim
src/testdir/test_syntax.vim
src/version.c

index cc293a5979ef3c5d08b4df14ecd0283a1f437721..6715f655ba3bd44c254f91b9ce406830efa23ee3 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.1.  Last change: 2024 Jan 03
+*syntax.txt*   For Vim version 9.1.  Last change: 2024 Jan 06
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -271,6 +271,10 @@ you can see the actual color, except for "Ignore"):
        *Todo           anything that needs extra attention; mostly the
                        keywords TODO FIXME and XXX
 
+       *Added          added line in a diff
+       *Changed        changed line in a diff
+       *Removed        removed line in a diff
+
 The names marked with * are the preferred groups; the others are minor groups.
 For the preferred groups, the "syntax.vim" file contains default highlighting.
 The minor groups are linked to the preferred groups, so they get the same
@@ -1261,7 +1265,7 @@ To highlight KDE-reserved features, set >
 g:desktop_enable_kde follows g:desktop_enable_nonstd if not supplied
 
 
-DIFF                                           *diff.vim* *ft-diff-syntax*
+DIFF                                                   *diff.vim*
 
 The diff highlighting normally finds translated headers.  This can be slow if
 there are very long lines in the file.  To disable translations: >
@@ -1270,15 +1274,6 @@ there are very long lines in the file.  To disable translations: >
 
 Also see |diff-slow|.
 
-Since the Vim 9.1 release |version-9.1| the diff filetype links the diffAdded,
-diffRemoved and diffChanged highlighting groups to |hl-DiffAdd|,
-|hl-DiffDelete| and |hl-DiffChange| by default.  If you do not want this, you
-can change it to the previous groups like this in your |.vimrc| >
-
-       hi link diffRemoved Special
-       hi link diffChanged PreProc
-       hi link diffAdded Identifier
-<
 DIRCOLORS                             *dircolors.vim* *ft-dircolors-syntax*
 
 The dircolors utility highlighting definition has one option.  It exists to
index 5b9e5a9b64e0066d0dbb8533a6a5ce3086e8b11d..1b55fa1943ac39cbd372bfbcc4e0444fa88db6ca 100644 (file)
@@ -7207,7 +7207,6 @@ ft-cynlib-syntax  syntax.txt      /*ft-cynlib-syntax*
 ft-dart-syntax syntax.txt      /*ft-dart-syntax*
 ft-dash-syntax syntax.txt      /*ft-dash-syntax*
 ft-desktop-syntax      syntax.txt      /*ft-desktop-syntax*
-ft-diff-syntax syntax.txt      /*ft-diff-syntax*
 ft-dircolors-syntax    syntax.txt      /*ft-dircolors-syntax*
 ft-docbk-syntax        syntax.txt      /*ft-docbk-syntax*
 ft-docbksgml-syntax    syntax.txt      /*ft-docbksgml-syntax*
index b5c3f5ecbbb01bedd6be2282551203f6646b62e1..b0a8594def3fc8f074458d3a0f08d2f2da361e8d 100644 (file)
@@ -378,9 +378,9 @@ hi def link diffBDiffer             Constant
 hi def link diffIsA            Constant
 hi def link diffNoEOL          Constant
 hi def link diffCommon         Constant
-hi def link diffRemoved                DiffDelete
-hi def link diffChanged                DiffChange
-hi def link diffAdded          DiffAdd
+hi def link diffRemoved                Removed
+hi def link diffChanged                Changed
+hi def link diffAdded          Added
 hi def link diffLine           Statement
 hi def link diffSubname                PreProc
 hi def link diffComment                Comment
index b734c2c4b0dea7b28c9979c6cd2017fe1340ef8f..2024d383984c6eeed70a7921853c1e1c8eaa0f32 100644 (file)
@@ -141,6 +141,10 @@ syn match helpTodo         "\t[* ]Todo\t\+[a-z].*"
 
 syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'         <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'        <>"]+)[a-zA-Z0-9/]`
 
+syn match helpDiffAdded                "\t[* ]Added\t\+[a-z].*"
+syn match helpDiffChanged      "\t[* ]Changed\t\+[a-z].*"
+syn match helpDiffRemoved      "\t[* ]Removed\t\+[a-z].*"
+
 " Additionally load a language-specific syntax file "help_ab.vim".
 let s:i = match(expand("%"), '\.\a\ax$')
 if s:i > 0
@@ -216,6 +220,9 @@ hi def link helpUnderlined  Underlined
 hi def link helpError          Error
 hi def link helpTodo           Todo
 hi def link helpURL            String
+hi def link helpDiffAdded      Added
+hi def link helpDiffChanged    Changed
+hi def link helpDiffRemoved    Removed
 
 if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
   " highlight groups with their respective color
index 6cf38cfa5d500b63ca36c31406bebc78b1b04988..52b3a0b60df15f23a0f35db4b538cd0054514c8d 100644 (file)
@@ -41,6 +41,9 @@ if &background == "dark"
   SynColor Type                term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE
   SynColor Underlined  term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff
   SynColor Ignore      term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE
+  SynColor Added       term=NONE cterm=NONE ctermfg=Green ctermbg=NONE gui=NONE guifg=LimeGreen guibg=NONE
+  SynColor Changed     term=NONE cterm=NONE ctermfg=Blue ctermbg=NONE gui=NONE guifg=DodgerBlue guibg=NONE
+  SynColor Removed     term=NONE cterm=NONE ctermfg=Red ctermbg=NONE gui=NONE guifg=Red guibg=NONE
 else
   SynColor Comment     term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE
   SynColor Constant    term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE
@@ -53,6 +56,9 @@ else
   SynColor Type                term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE
   SynColor Underlined  term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
   SynColor Ignore      term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE
+  SynColor Added       term=NONE cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=SeaGreen guibg=NONE
+  SynColor Changed     term=NONE cterm=NONE ctermfg=Blue ctermbg=NONE gui=NONE guifg=DodgerBlue guibg=NONE
+  SynColor Removed     term=NONE cterm=NONE ctermfg=Red ctermbg=NONE gui=NONE guifg=Red guibg=NONE
 endif
 SynColor Error         term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red
 SynColor Todo          term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow
index 8c56730daf0040f5586db1ccd342d1bd16fe2a79..aeb2c51c580400759ff89e9a4437f442beb729b3 100644 (file)
@@ -193,14 +193,14 @@ func Test_syntax_completion()
   " Check that clearing "Aap" avoids it showing up before Boolean.
   hi Aap ctermfg=blue
   call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
-  call assert_match('^"syn list Aap Boolean Character ', @:)
+  call assert_match('^"syn list Aap Added Boolean Changed Character ', @:)
   hi clear Aap
 
   call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
-  call assert_match('^"syn list Boolean Character ', @:)
+  call assert_match('^"syn list Added Boolean Changed Character ', @:)
 
   call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx')
-  call assert_match('^"syn match Boolean Character ', @:)
+  call assert_match('^"syn match Added Boolean Changed Character ', @:)
 
   syn cluster Aax contains=Aap
   call feedkeys(":syn list @A\<C-A>\<C-B>\"\<CR>", 'tx')
index 9a4106de49ea591ccdd68f4eae63d5316a198263..2e178f3bb35a2ee33c0946c723e058ce98f33a86 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    16,
 /**/
     15,
 /**/