forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreesitter.lua
More file actions
93 lines (80 loc) · 1.98 KB
/
treesitter.lua
File metadata and controls
93 lines (80 loc) · 1.98 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
-- plugin: nvim-treesitter
-- see: https://github.com/nvim-treesitter/nvim-treesitter
-- rafi settings
-- Setup extra parsers.
local parser_configs = require('nvim-treesitter.parsers').get_parser_configs()
parser_configs.http = {
install_info = {
url = 'https://github.com/NTBBloodbath/tree-sitter-http',
files = { 'src/parser.c' },
branch = 'main',
},
filetype = 'http',
}
parser_configs.org = {
install_info = {
url = 'https://github.com/milisims/tree-sitter-org',
revision = 'main',
files = {'src/parser.c', 'src/scanner.cc'},
},
filetype = 'org',
}
-- Setup treesitter
require('nvim-treesitter.configs').setup({
-- all, maintained, or list of languages
ensure_installed = 'maintained',
highlight = {
enable = true,
disable = { 'vim' },
},
additional_vim_regex_highlighting = false,
-- incremental_selection = {
-- enable = true,
-- keymaps = {
-- init_selection = 'gnn',
-- node_incremental = 'grn',
-- scope_incremental = 'grc',
-- node_decremental = 'grm',
-- },
-- },
indent = {
enable = true,
},
refactor = {
highlight_definitions = { enable = true },
highlight_current_scope = { enable = true },
},
-- See: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
},
-- See: https://github.com/JoosepAlviste/nvim-ts-context-commentstring
context_commentstring = {
enable = true,
-- Let other plugins (kommentary) call 'update_commentstring()' manually.
enable_autocmd = false,
},
-- See: https://github.com/windwp/nvim-ts-autotag
autotag = {
enable = true,
filetypes = {
'html',
'javascript',
'javascriptreact',
'typescriptreact',
'svelte',
'vue',
}
}
})