-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnvim-treesitter.lua
More file actions
107 lines (101 loc) · 4.08 KB
/
Copy pathnvim-treesitter.lua
File metadata and controls
107 lines (101 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
local ret = {
['@variable'] = 'Variable',
['@variable.parameter'] = 'Parameter',
['@variable.member'] = 'Field', -- field; TODO: concrete distinctions
['@property'] = 'Field', -- field with getter/setter
['@attribute'] = 'Parameter', -- direct access public field, given on creation → parameter-like
['@environment'] = 'Constant',
['@constant.builtin'] = 'Boolean',
['@variable.builtin'] = { fg = 'BuiltinVar', italic = true },
['@function.builtin'] = { fg = 'BuiltinFn', italic = true },
['@namespace'] = 'BuiltinVar',
['@keyword.directive'] = 'PreProc',
['@function.macro'] = { fg = 'PreProc', underline = true, bold = true, sp = 'Define' },
['@module'] = '@namespace',
['@module.builtin'] = '@variable.builtin',
['@constructor'] = 'Type',
['@type.builtin'] = { fg = 'Type', italic = true },
['@storageclass'] = 'Keyword',
['@keyword.conditional'] = 'Conditional',
['@keyword.repeat'] = 'Repeat',
['@keyword.return'] = 'FlowControl',
['@keyword.operator'] = 'Operator',
['@string.special'] = 'LightOrange',
['@punctuation.special'] = '@punctuation',
--- custom definition for matches of definitions
['FnDecl'] = { fg = 'Function', sp = 'Define', underline = true, bold = true },
['@function.decl'] = 'FnDecl',
['@function.method.decl'] = 'FnDecl',
['@function.call'] = '@function',
['@function.method.call'] = '@function',
-- Java & C#
['@type.qualifier'] = 'Keyword',
['@attribute.java'] = 'PreProc',
['@attribute.c_sharp'] = 'PreProc',
-- HTML
['@tag'] = 'Tag',
['@tag.delimiter'] = 'Delimiter',
['@tag.attribute'] = '@attribute',
-- SQL
['@type.qualifier.sql'] = 'Conditional',
['@keyword.operator.sql'] = 'Conditional',
-- Vim
['@variable.builtin.vim'] = 'Variable',
['@string.regex.vim'] = '@string.special',
['@string.special.vim'] = '@string',
-- Make
['@string.special.symbol.make'] = 'Constant',
['@string.make'] = 'Variable',
-- Lua
['@constructor.lua'] = 'Delimiter',
-- Bash
['@function.bash'] = 'FnDecl',
['@string.special.path'] = 'File',
-- Markdown, LaTeX
['@markup.list.checked'] = { fg = 'Green', bold = true },
['@markup.list.unchecked'] = 'Todo',
['@markup.link.label'] = 'Url',
['@markup.link.url'] = { fg = 'SpecialComment', underline = true },
['@markup.italic'] = 'Italic',
['@markup.strong'] = 'Bold',
['@markup.quote'] = { fg = 'Fg2', bg = 'Bg1b', italic = true },
['@markup.strikethrough'] = { strikethrough = true },
['@markup.heading'] = '', -- workaround for overwriting heading highlights
['@markup.heading.marker'] = { fg = 'FlowControl', bold = true },
['@markup.heading.1'] = { fg = 'Title', bold = true, underdouble = true },
['@markup.heading.2'] = { fg = 'Title', bold = true, underdouble = true, italic = true },
['@markup.heading.3'] = { fg = 'Title', bold = true, underline = true },
['@markup.heading.4'] = { fg = 'Title', bold = true, underline = true, italic = true },
['@markup.heading.5'] = { fg = 'Title', bold = true, underdashed = true },
['@markup.heading.6'] = { fg = 'Title', bold = true, underdashed = true, italic = true },
['@markup.list'] = 'Red',
['@markup.link'] = 'Delimiter',
['@conceal.markdown_inline'] = 'Delimiter',
['@markup.raw.delimiter'] = 'Delimiter',
['@markup.raw.block'] = { fg = 'Fg2' },
['@markup.raw'] = 'PreProc',
-- Other
['@type.builtin.kotlin'] = 'Type',
['@keyword.import.c'] = 'PreProc',
['@keyword.import.cpp'] = 'PreProc',
['@conceal.json'] = 'String',
['@module.javascript'] = 'Variable',
['@module.typescript'] = 'Variable',
['@operator.regex'] = '@string.special',
['@type.query'] = 'Label',
['@keyword.jsdoc'] = 'PreProc',
['@keyword.doxygen'] = 'PreProc',
['@comment.note'] = 'Todo',
}
local has = require('nvim-treesitter').get_installed()
-- conditionally disable lsp highlighting in preference of parsers
if vim.list_contains(has, 'luadoc') then
ret['@keyword.luadoc'] = 'PreProc'
ret['@function.macro.luadoc'] = { fg = 'Type', sp = 'Define', underline = true, bold = true }
ret['@lsp.type.variable.lua'] = ''
-- ret['@lsp.type.type.lua'] = ''
ret['@lsp.type.macro.lua'] = ''
else
ret['@lsp.type.macro.lua'] = { fg = 'Type', sp = 'Define', underline = true, bold = true }
end
return ret