From 030b422d1e9517ed1b1c70fd8002b74881c80650 Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 24 Aug 2022 23:48:52 +0200 Subject: feat(treesitter)!: use @foo.bar style highlight groups This removes the support for defining links via vim.treesitter.highlighter.hl_map (never documented, but plugins did anyway), or the uppercase-only `@FooGroup.Bar` to `FooGroup` rule. The fallback is now strictly `@foo.bar.lang` to `@foo.bar` to `@foo`, and casing is irrelevant (as it already was outside of treesitter) For compatibility, define default links to builting syntax groups as defined by pre-existing color schemes --- src/nvim/highlight_group.c | 48 +++++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_cmdline.vim | 6 ++--- 2 files changed, 50 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 4c207fdb53..7a0c7ba395 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -185,6 +185,54 @@ static const char *highlight_init_both[] = { "default link DiagnosticSignWarn DiagnosticWarn", "default link DiagnosticSignInfo DiagnosticInfo", "default link DiagnosticSignHint DiagnosticHint", + + "default link @error Error", + "default link @text.underline Underlined", + "default link @todo Todo", + "default link @debug Debug", + + // Miscs + "default link @comment Comment", + "default link @punctuation Delimiter", + + // Constants + "default link @constant Constant", + "default link @constant.builtin Special", + "default link @constant.macro Define", + "default link @define Define", + "default link @macro Macro", + "default link @string String", + "default link @string.escape SpecialChar", + "default link @character Character", + "default link @character.special SpecialChar", + "default link @number Number", + "default link @boolean Boolean", + "default link @float Float", + + // Functions + "default link @function Function", + "default link @function.builtin Special", + "default link @function.macro Macro", + "default link @parameter Identifier", + "default link @method Function", + "default link @field Identifier", + "default link @property Identifier", + "default link @constructor Special", + + // Keywords + "default link @conditional Conditional", + "default link @repeat Repeat", + "default link @label Label", + "default link @operator Operator", + "default link @keyword Keyword", + "default link @exception Exception", + + "default link @type Type", + "default link @type.definition Typedef", + "default link @storageclass StorageClass", + "default link @structure Structure", + "default link @include Include", + "default link @preproc PreProc", NULL }; diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 84dc361529..517509004a 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -244,7 +244,7 @@ func Test_match_completion() return endif hi Aardig ctermfg=green - call feedkeys(":match \\\"\", 'xt') + call feedkeys(":match A\\\"\", 'xt') call assert_equal('"match Aardig', getreg(':')) call feedkeys(":match \\\"\", 'xt') call assert_equal('"match none', getreg(':')) @@ -255,9 +255,7 @@ func Test_highlight_completion() return endif hi Aardig ctermfg=green - call feedkeys(":hi \\\"\", 'xt') - call assert_equal('"hi Aardig', getreg(':')) - call feedkeys(":hi default \\\"\", 'xt') + call feedkeys(":hi default A\\\"\", 'xt') call assert_equal('"hi default Aardig', getreg(':')) call feedkeys(":hi clear Aa\\\"\", 'xt') call assert_equal('"hi clear Aardig', getreg(':')) -- cgit