change treesitter config

This commit is contained in:
Alexander Navarro 2023-10-26 18:10:28 -03:00
parent f6ac8030ab
commit a08df1abf1

View file

@ -7,86 +7,85 @@ return {
"JoosepAlviste/nvim-ts-context-commentstring", "JoosepAlviste/nvim-ts-context-commentstring",
}, },
build = ":TSUpdate", build = ":TSUpdate",
opts = { config = function()
-- Add languages to be installed here that you want installed for treesitter require("nvim-treesitter.configs").setup({
ensure_installed = { -- Add languages to be installed here that you want installed for treesitter
"bash", ensure_installed = {
"c", "bash",
"cpp", "c",
"go", "cpp",
"lua", "go",
"markdown", "lua",
"markdown_inline", "markdown",
"python", "markdown_inline",
"regex", "python",
"rust", "regex",
"tsx", "rust",
"typescript", "tsx",
"vim", "typescript",
"vimdoc", "vim",
}, "vimdoc",
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
}, },
}, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
textobjects = { auto_install = true,
select = { highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true, enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = { keymaps = {
-- You can use the capture groups defined in textobjects.scm init_selection = "<c-space>",
["aa"] = "@parameter.outer", node_incremental = "<c-space>",
["ia"] = "@parameter.inner", scope_incremental = "<c-s>",
["af"] = "@function.outer", node_decremental = "<M-space>",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
}, },
}, },
move = { textobjects = {
enable = true, select = {
set_jumps = true, -- whether to set jumps in the jumplist enable = true,
goto_next_start = { lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
["]m"] = "@function.outer", keymaps = {
["]]"] = "@class.outer", -- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
}, },
goto_next_end = { move = {
["]M"] = "@function.outer", enable = true,
["]["] = "@class.outer", set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
}, },
goto_previous_start = { swap = {
["[m"] = "@function.outer", enable = true,
["[["] = "@class.outer", swap_next = {
}, ["<leader>a"] = "@parameter.inner",
goto_previous_end = { },
["[M"] = "@function.outer", swap_previous = {
["[]"] = "@class.outer", ["<leader>A"] = "@parameter.inner",
},
}, },
}, },
swap = { autotag = { enable = true },
enable = true, context_commentstring = { enable = true, enable_autocmd = false },
swap_next = { })
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
vim.opt.foldmethod = "expr" vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldexpr = "nvim_treesitter#foldexpr()"