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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
'RRethy/nvim-treesitter-endwise',
"nvim-treesitter/nvim-treesitter-textobjects",
'nvim-treesitter/playground',
},
event = { 'BufReadPre', 'BufNew', 'BufNewFile' },
main = "nvim-treesitter.configs",
cmd = {
'TSBufDisable',
'TSBufEnable',
'TSBufToggle',
'TSConfigInfo',
'TSDisable',
'TSEditQuery',
'TSEditQueryUserAfter',
'TSEnable',
'TSInstall',
'TSInstallFromGrammar',
'TSInstallInfo',
'TSInstallSync',
'TSModuleInfo',
'TSToggle',
'TSUninstall',
'TSUpdate',
'TSUpdateSync',
'TSPlaygroundToggle',
},
opts = {
endwise = {
enable = true,
disable = { "markdown", "markdown_inline" },
},
auto_install = true,
ensure_installed = {
"bash",
"blade",
"css",
"go",
"gomod",
"html",
"javascript",
"json",
"lua",
"luadoc",
"markdown",
"markdown_inline",
"typst",
"nix",
"org",
"php",
"php_only",
"phpdoc",
"query",
"rust",
"sql",
"svelte",
"typescript",
"twig",
"regex",
"vim",
"yaml",
"latex",
"python",
"dockerfile",
"cpp",
"elixir",
"erlang",
},
highlight = {
enable = true,
disable = function(_, buf)
local ft = vim.bo[buf].filetype
return ft == "oil" or ft == "snacks_notif"
end,
additional_vim_regex_highlighting = { "org" },
},
playground = {
enable = true,
disable = {},
updatetime = 25, -- Tiempo de actualización en milisegundos para la consulta del árbol.
persist_queries = false, -- Si se debe persistir las consultas entre sesiones.
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = {"BufWrite", "CursorHold"},
},
indent = {
enable = true,
disable = { "oil", "snacks_notif" },
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
},
},
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
},
config = function(plug, config)
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = {"src/parser.c"},
branch = "main",
},
filetype = "blade"
}
vim.filetype.add({
pattern = {
['.*%.blade%.php'] = 'blade',
}
})
-- Reuse markdown parser for plugin-specific scratch buffers.
vim.treesitter.language.register("markdown", "codecompanion")
vim.treesitter.language.register("markdown", "snacks_notif")
vim.treesitter.language.register("markdown", "oil")
-- Some markdown injections generated by external plugins can point to
-- placeholder languages and crash parser injection resolution.
pcall(vim.treesitter.query.set, "markdown", "injections", "")
require(plug.main).setup(config);
end,
}
|