2023-02-20 11:09:53 +00:00
|
|
|
return {
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
2023-02-20 11:32:30 +00:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-05-11 10:44:22 +01:00
|
|
|
dependencies = { "nvim-treesitter/nvim-treesitter-refactor" },
|
2023-02-21 17:31:20 +00:00
|
|
|
cmd = {
|
|
|
|
"TSToggle",
|
|
|
|
"TSBufEnable",
|
|
|
|
"TSBufToggle",
|
|
|
|
"TSInstall",
|
|
|
|
"TSUpdate",
|
2023-03-03 11:12:22 +00:00
|
|
|
"TSEnable",
|
2023-02-21 17:31:20 +00:00
|
|
|
},
|
2023-05-11 18:03:39 +01:00
|
|
|
config = function(_, opts)
|
|
|
|
if type(opts.ensure_installed) == "table" then
|
|
|
|
-- @type table<string, boolean>
|
|
|
|
local added = {}
|
|
|
|
opts.ensure_installed = vim.tbl_filter(function(lang)
|
|
|
|
if added[lang] then return false end
|
|
|
|
added[lang] = true
|
|
|
|
return true
|
|
|
|
end, opts.ensure_installed)
|
|
|
|
end
|
|
|
|
require("nvim-treesitter.configs").setup(opts)
|
|
|
|
end,
|
2023-05-11 10:44:22 +01:00
|
|
|
opts = {
|
2023-05-12 11:51:04 +01:00
|
|
|
ensure_installed = "all",
|
|
|
|
auto_install = true,
|
2023-05-11 10:44:22 +01:00
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
additional_vim_regex_highlighting = false,
|
|
|
|
},
|
|
|
|
incremental_selection = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
init_selection = "gnn",
|
|
|
|
node_incremental = "gnr",
|
|
|
|
scope_incremental = "gnc",
|
|
|
|
node_decremental = "gnm",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
refactor = {
|
|
|
|
smart_rename = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
smart_rename = "grr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
navigation = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
goto_definition_lsp_fallback = "gnd",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-03-10 11:56:00 +00:00
|
|
|
},
|
2023-02-20 11:09:53 +00:00
|
|
|
}
|