From 9afa0d25a66f849452f498bd45e2f443f5010635 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 27 Jul 2021 10:46:24 -0600 Subject: fix(highlight): remove syncolor.vim Remove syncolor.vim in favor of defining the default highlight groups directly in `init_highlight`. This approach provides a number of advantages: 1. The highlights are always defined, regardless of whether or not the syntax regex engine is enabled. 2. Redundant sourcing of syntax files is eliminated (syncolor.vim was often sourced multiple times based on how the user's colorscheme file was written). 3. The syntax highlighting regex engine and the highlight groups themselves are more fully decoupled. 4. Removal of the confusing `:syntax on` / `:syntax enable` dichotomy (they now both do the same thing). This approach also correctly solves a number of bugs related to highlighting (#15176, #12573, #15205). --- test/unit/viml/expressions/parser_spec.lua | 58 ++++++++++++++---------------- 1 file changed, 26 insertions(+), 32 deletions(-) (limited to 'test') diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua index 032baf6578..8342044b5e 100644 --- a/test/unit/viml/expressions/parser_spec.lua +++ b/test/unit/viml/expressions/parser_spec.lua @@ -52,6 +52,32 @@ local predefined_hl_defs = { QuickFixLine=true, Substitute=true, Whitespace=true, + Error=true, + Todo=true, + String=true, + Character=true, + Number=true, + Boolean=true, + Float=true, + Function=true, + Conditional=true, + Repeat=true, + Label=true, + Operator=true, + Keyword=true, + Exception=true, + Include=true, + Define=true, + Macro=true, + PreCondit=true, + StorageClass=true, + Structure=true, + Typedef=true, + Tag=true, + SpecialChar=true, + Delimiter=true, + SpecialComment=true, + Debug=true, -- From highlight_init_(dark|light) ColorColumn=true, @@ -83,8 +109,6 @@ local predefined_hl_defs = { Visual=true, WarningMsg=true, Normal=true, - - -- From syncolor.vim, if &background Comment=true, Constant=true, Special=true, @@ -94,36 +118,6 @@ local predefined_hl_defs = { Type=true, Underlined=true, Ignore=true, - - -- From syncolor.vim, below if &background - Error=true, - Todo=true, - - -- From syncolor.vim, links at the bottom - String=true, - Character=true, - Number=true, - Boolean=true, - Float=true, - Function=true, - Conditional=true, - Repeat=true, - Label=true, - Operator=true, - Keyword=true, - Exception=true, - Include=true, - Define=true, - Macro=true, - PreCondit=true, - StorageClass=true, - Structure=true, - Typedef=true, - Tag=true, - SpecialChar=true, - Delimiter=true, - SpecialComment=true, - Debug=true, } local nvim_hl_defs = {} -- cgit From cab90f2ef1f3f60786a1f223fb7c2582aac1773a Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 28 Jul 2021 09:11:07 -0600 Subject: fixup! fix(highlight): remove syncolor.vim --- test/functional/ui/cmdline_spec.lua | 4 +++- test/functional/ui/highlight_spec.lua | 2 +- test/functional/ui/sign_spec.lua | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 0ea8bab957..ad23402ff9 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -14,6 +14,8 @@ local function new_screen(opt) [3] = {bold = true, reverse = true}, [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, [5] = {bold = true, foreground = Screen.colors.SeaGreen4}, + [6] = {foreground = Screen.colors.Magenta}, + [7] = {bold = true, foreground = Screen.colors.Brown}, }) return screen end @@ -267,7 +269,7 @@ local function test_cmdline(linegrid) special = {'"', true}, }, { firstc = "=", - content = {{"1"}, {"+"}, {"2"}}, + content = {{"1", 6}, {"+", 7}, {"2", 6}}, pos = 3, }} diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 8992ee27ce..7471255345 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -789,7 +789,7 @@ describe("'listchars' highlight", function() [0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {background=Screen.colors.Grey90}, [2] = {foreground=Screen.colors.Red}, - [3] = {foreground=Screen.colors.Green1}, + [3] = {foreground=Screen.colors.X11Green, background=Screen.colors.Red1}, }) feed_command('highlight clear ModeMsg') feed_command('highlight Whitespace guifg=#FF0000') diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 06c92a4b10..741b93043d 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -176,8 +176,8 @@ describe('Signs', function() command('sign place 5 line=3 name=pietWarn buffer=1') command('sign place 3 line=3 name=pietError buffer=1') screen:expect([[ - {1:>>}XX{6: 1 }a | - XX{1:>>}{6: 2 }b | + {1:>>}{8:XX}{6: 1 }a | + {8:XX}{1:>>}{6: 2 }b | {1:>>}WW{6: 3 }c | {2: }{6: 4 }^ | {0:~ }| @@ -194,7 +194,7 @@ describe('Signs', function() -- With the default setting, we get the sign with the top id. command('set signcolumn=yes:1') screen:expect([[ - XX{6: 1 }a | + {8:XX}{6: 1 }a | {1:>>}{6: 2 }b | WW{6: 3 }c | {2: }{6: 4 }^ | @@ -212,9 +212,9 @@ describe('Signs', function() -- "auto:3" accommodates all the signs we defined so far. command('set signcolumn=auto:3') screen:expect([[ - {1:>>}XX{2: }{6: 1 }a | - XX{1:>>}{2: }{6: 2 }b | - XX{1:>>}WW{6: 3 }c | + {1:>>}{8:XX}{2: }{6: 1 }a | + {8:XX}{1:>>}{2: }{6: 2 }b | + {8:XX}{1:>>}WW{6: 3 }c | {2: }{6: 4 }^ | {0:~ }| {0:~ }| @@ -230,9 +230,9 @@ describe('Signs', function() -- Check "yes:9". command('set signcolumn=yes:9') screen:expect([[ - {1:>>}XX{2: }{6: 1 }a | - XX{1:>>}{2: }{6: 2 }b | - XX{1:>>}WW{2: }{6: 3 }c | + {1:>>}{8:XX}{2: }{6: 1 }a | + {8:XX}{1:>>}{2: }{6: 2 }b | + {8:XX}{1:>>}WW{2: }{6: 3 }c | {2: }{6: 4 }^ | {0:~ }| {0:~ }| @@ -249,9 +249,9 @@ describe('Signs', function() -- a single line (same result as "auto:3"). command('set signcolumn=auto:4') screen:expect{grid=[[ - {1:>>}XX{2: }{6: 1 }a | - XX{1:>>}{2: }{6: 2 }b | - XX{1:>>}WW{6: 3 }c | + {1:>>}{8:XX}{2: }{6: 1 }a | + {8:XX}{1:>>}{2: }{6: 2 }b | + {8:XX}{1:>>}WW{6: 3 }c | {2: }{6: 4 }^ | {0:~ }| {0:~ }| @@ -267,8 +267,8 @@ describe('Signs', function() -- line deletion deletes signs. command('2d') screen:expect([[ - {1:>>}XX{2: }{6: 1 }a | - XX{1:>>}WW{6: 2 }^c | + {1:>>}{8:XX}{2: }{6: 1 }a | + {8:XX}{1:>>}WW{6: 2 }^c | {2: }{6: 3 } | {0:~ }| {0:~ }| -- cgit