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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
return {
{
'nvim-treesitter/nvim-treesitter',
dependencies = {
-- TODO: https://github.com/nvim-treesitter/nvim-treesitter-context
{ 'nvim-treesitter/nvim-treesitter-refactor', lazy = false },
{ 'nvim-treesitter/nvim-treesitter-textobjects', lazy = false },
{ 'nvim-treesitter/playground', cmd = { 'TSPlayground' } },
},
lazy = false,
build = ':TSUpdate',
config = function(_, opts)
-- TODO: overwrite parser configs, insert gotmpl
require('nvim-treesitter.configs').setup(opts)
-- use bash parser for gentoo ebuilds
vim.treesitter.language.register('bash', 'ebuild')
-- register mediawiki parser
-- local parser_configs = require('nvim-treesitter.parsers').get_parser_configs()
-- parser_configs.mediawiki = {
-- install_info = {
-- url = 'github.com/Ordoviz/tree-sitter-mediawiki',
-- files = { 'src/parser.c' },
-- branch = 'main',
-- generate_requires_npm = false,
-- requires_generate_from_grammar = false,
-- },
-- filetype = 'mediawiki',
-- }
end,
opts = {
ensure_installed = {
'bash',
'bibtex',
'c',
'c_sharp',
'cmake',
'comment',
'cpp',
'css',
'dockerfile',
'go',
'gomod',
'gotmpl',
'gowork',
'hare',
'hcl',
'html',
'java',
'javascript',
'json',
'jsonc',
'kotlin',
'latex',
'ledger',
'lua',
'make',
'markdown',
'markdown_inline',
'ninja',
'norg',
'python',
'query',
'regex',
'rust',
'scss',
'sql',
'toml',
'typescript',
'vim',
'vimdoc',
'yaml',
'zig',
-- external parsers
-- 'mediawiki', -- TODO: missing queries
},
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'markdown' },
},
indent = {
enable = true,
},
refactor = {
navigation = {
enable = true,
keymaps = {
goto_definition = 'gd',
},
},
smart_rename = {
enable = true,
keymaps = {
smart_rename = 'grr',
},
},
},
textobjects = {
select = {
enable = true,
keymaps = {
['ib'] = '@block.inner',
['ab'] = '@block.outer',
-- ['ic'] = '@conditional.inner',
-- ['ac'] = '@conditional.outer',
['if'] = '@function.inner',
['af'] = '@function.outer',
['il'] = '@loop.inner',
['al'] = '@loop.outer',
['is'] = '@scopename.inner',
['as'] = '@scopename.outer',
['ic'] = '@comment.outer',
},
selection_mode = {
['@comment.outer'] = 'V',
},
},
},
},
},
}
|