my-nvim-lua/lua/custom/plugins/configs/treesitter.lua
spike 0684ba9657 Treesitter refactoring
- treesitter smart select "v<CR>" and <Tab>
- treesitter swap func params with ~
- map ,tf to set TS to fold method
2022-09-11 13:45:33 +02:00

102 lines
2.0 KiB
Lua

return {
ensure_installed = {
"lua",
"go",
"rust",
"fish",
"bash",
"python",
"c",
"haskell",
"javascript",
"html",
"markdown",
"markdown_inline",
"make",
"sql",
"yaml",
"toml",
"vue",
},
incremental_selection = {
enable = false,
keymaps = {
init_selection = "<CR>",
node_incremental = "<Tab>",
scope_incremental = "<CR>",
node_decremental = "<S-Tab>",
}
},
textsubjects = {
enable = true,
prev_selection = "<Tab>",
keymaps = {
["<CR>"] = "textsubjects-smart", -- works in visual mode
}
},
rainbow = {
enable = true,
extended_mode = true,
},
textobjects = {
enable = true,
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["aC"] = "@conditional.outer",
["iC"] = "@conditional.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["is"] = "@statement.inner",
["as"] = "@statement.outer",
["ad"] = "@comment.outer",
["am"] = "@call.outer",
["im"] = "@call.inner",
}
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer"
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer"
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer"
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
},
swap = {
enable = true,
swap_next = {
["~"] = "@parameter.inner"
},
}
}
}