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", "LarssonMartin1998/lspsaga.nvim",
branch = "improved_winbar", branch = "improved_winbar",
dependencies = { dependencies = {
"nvim-treesitter/nvim-treesitter", -- "nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
config = function() config = function()

View file

@ -1,18 +1,56 @@
return { return {
"nvim-treesitter/nvim-treesitter", "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 = { ensure_installed = {
"vim", "vim",
"vimdoc", "vimdoc",
"lua" "bash",
"lua",
"c",
"cpp",
"rust",
"cmake",
"make",
"yaml",
"ninja",
"gitignore",
}, },
sync_install = false, sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true -- This can be updated to a list of languages instead of defaulting to true
highlight = { enable = true }, highlight = { enable = true },
indent = {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 = { textobjects = {
"nvim-treesitter/nvim-treesitter-context" 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"
}