2022-10-21 06:15:28 -04:00
|
|
|
local ok,nvim_treesitter_configs = pcall(require,"nvim-treesitter.configs")
|
|
|
|
if not ok then
|
|
|
|
vim.notify("Failed to load nvim-treesitter\n\n")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
nvim_treesitter_configs.setup {
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
disable = {},
|
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
enable = false,
|
|
|
|
disable = {},
|
|
|
|
},
|
2023-01-03 14:13:09 -05:00
|
|
|
|
|
|
|
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
|
2023-08-27 06:01:33 -04:00
|
|
|
['aa'] = '@parameter.outer',
|
|
|
|
['ia'] = '@parameter.inner',
|
|
|
|
['af'] = '@function.outer',
|
|
|
|
['if'] = '@function.inner',
|
|
|
|
['ac'] = '@class.outer',
|
|
|
|
['ic'] = '@class.inner',
|
2023-01-03 14:13:09 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
set_jumps = true,
|
|
|
|
goto_next_start = {
|
|
|
|
[']m'] = '@function.outer',
|
|
|
|
[']]'] = '@class.outer'
|
|
|
|
},
|
|
|
|
goto_next_end = {
|
|
|
|
[']M'] = '@function.outer',
|
|
|
|
[']['] = '@class.outer'
|
|
|
|
},
|
|
|
|
goto_previous_start = {
|
|
|
|
['[m'] = '@function.outer',
|
|
|
|
['[['] = '@class.outer'
|
|
|
|
},
|
|
|
|
goto_previous_end = {
|
|
|
|
['[M'] = '@function.outer',
|
|
|
|
['[]'] = '@class.outer'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-10-21 06:15:28 -04:00
|
|
|
ensure_installed = {
|
|
|
|
"lua",
|
2023-01-03 14:13:09 -05:00
|
|
|
"fish",
|
2022-10-21 06:15:28 -04:00
|
|
|
"python",
|
2023-01-03 14:13:09 -05:00
|
|
|
"go",
|
|
|
|
"javascript",
|
|
|
|
"css",
|
|
|
|
"html",
|
|
|
|
"c",
|
|
|
|
"cpp"
|
2022-10-21 06:15:28 -04:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
|
|
parser_config.tsx.filetype_to_parsername = { "javascript", "typescript.tsx" }
|