Add lots of languagu parsers, add textobjects, and add incremental selection

This commit is contained in:
Martin Larsson 2024-01-22 13:41:33 +01:00
parent d1b9cfa362
commit c09b607b8d
3 changed files with 52 additions and 17 deletions

View file

@ -2,7 +2,7 @@ return {
"LarssonMartin1998/lspsaga.nvim",
branch = "improved_winbar",
dependencies = {
"nvim-treesitter/nvim-treesitter",
-- "nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
config = function()

View file

@ -1,18 +1,56 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = {
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-context",
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"vim",
"vimdoc",
"lua"
"bash",
"lua",
"c",
"cpp",
"rust",
"cmake",
"make",
"yaml",
"ninja",
"gitignore",
},
sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-cr>",
node_incremental = "<C-cr>",
scope_incremental = false,
node_decremental = "<C-bs>",
},
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-context"
}
},
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,
}

View file

@ -1,3 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter-context"
}