2023-05-04 12:39:25 +01:00
|
|
|
return {
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
2023-05-16 09:35:57 +01:00
|
|
|
version = false,
|
|
|
|
build = ":TSUpdate",
|
2023-07-20 13:28:39 +01:00
|
|
|
cmd = {"TSUpdate", "TSInstall"},
|
2023-05-04 12:39:25 +01:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-06-10 08:29:21 +01:00
|
|
|
dependencies = "nvim-treesitter/nvim-treesitter-refactor",
|
2023-05-16 09:22:33 +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,
|
|
|
|
opts = {
|
2023-06-09 11:38:37 +01:00
|
|
|
auto_install = vim.fn.executable "nix" == 1,
|
2023-05-16 09:22:33 +01:00
|
|
|
highlight = {
|
|
|
|
enable = true,
|
2023-05-17 15:59:18 +01:00
|
|
|
disable = { "fortran" },
|
2023-05-16 09:22:33 +01:00
|
|
|
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-05-04 12:39:25 +01:00
|
|
|
},
|
|
|
|
}
|