dotfiles/.config/nvim/lua/plugins/treesitter.lua

67 lines
1.7 KiB
Lua
Raw Normal View History

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 = {},
},
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"
}
},
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",
"fish",
2022-10-21 06:15:28 -04:00
"python",
"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" }