Fix treesitter initialization

This commit is contained in:
Martin Larsson 2024-07-14 15:47:09 +02:00
parent 456fc0da59
commit 2fcf44dc3e

View file

@ -13,66 +13,68 @@ return {
}, },
"nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/nvim-treesitter-textobjects",
}, },
opts = { config = function()
ensure_installed = { require("nvim-treesitter.configs").setup({
"vim", ensure_installed = {
"vimdoc", "vim",
"bash", "vimdoc",
"lua", "bash",
"c", "lua",
"cpp", "c",
"c_sharp", "cpp",
"rust", "c_sharp",
"cmake", "rust",
"make", "cmake",
"yaml", "make",
"ninja", "yaml",
"gitignore", "ninja",
"markdown", "gitignore",
"markdown_inline", "markdown",
"hyprlang", "markdown_inline",
"json", "hyprlang",
"html", "json",
"hlsl", "html",
"glsl", "hlsl",
"gdshader", "glsl",
"gdscript", "gdshader",
"dockerfile", "gdscript",
"dart", "dockerfile",
"css", "dart",
"regex" "css",
}, "regex"
sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-cr>",
node_incremental = "<C-cr>",
scope_incremental = false,
node_decremental = "<C-bs>",
}, },
}, sync_install = false,
textobjects = { -- This can be updated to a list of languages instead of defaulting to true
select = { highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = { enable = true },
incremental_selection = {
enable = true, enable = true,
lookahead = true,
keymaps = { keymaps = {
["ic"] = { query = "@class.inner" }, init_selection = "<C-cr>",
["ac"] = { query = "@class.outer" }, node_incremental = "<C-cr>",
["ii"] = { query = "@conditional.inner" }, scope_incremental = false,
["ai"] = { query = "@conditional.outer" }, node_decremental = "<C-bs>",
["if"] = { query = "@function.inner" },
["af"] = { query = "@function.outer" },
["il"] = { query = "@loop.inner" },
["al"] = { query = "@loop.outer" },
}, },
}, },
}, textobjects = {
} select = {
enable = true,
lookahead = true,
keymaps = {
["ic"] = { query = "@class.inner" },
["ac"] = { query = "@class.outer" },
["ii"] = { query = "@conditional.inner" },
["ai"] = { query = "@conditional.outer" },
["if"] = { query = "@function.inner" },
["af"] = { query = "@function.outer" },
["il"] = { query = "@loop.inner" },
["al"] = { query = "@loop.outer" },
},
},
},
})
end
} }