2021-10-12 19:08:03 +02:00
|
|
|
-- Author : swytch
|
|
|
|
-- Created : Monday May 24, 2021 20:02:19 CET
|
|
|
|
-- License : GPLv3
|
|
|
|
-- Description : treesitter config file
|
|
|
|
|
2021-05-24 20:03:39 +02:00
|
|
|
require("nvim-treesitter.configs").setup {
|
2023-01-07 19:17:00 +01:00
|
|
|
ensure_installed = { "c", "lua", "rust", "bash", "vim" },
|
2022-04-27 21:58:12 +02:00
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
enable = true,
|
|
|
|
},
|
2023-01-07 19:17:00 +01:00
|
|
|
incremental_selection = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
init_selection = "<C-Space>",
|
|
|
|
node_incremental = "<C-Space>",
|
|
|
|
scope_incremental = "<Tab>",
|
|
|
|
node_decremental = "<BS>",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
|
|
keymaps = {
|
|
|
|
-- use the capture groups defined in textobjects.scm
|
|
|
|
["ap"] = {
|
|
|
|
query = "@parameter.outer",
|
|
|
|
desc = "Select parameter region"
|
|
|
|
},
|
|
|
|
["ip"] = {
|
|
|
|
query = "@parameter.inner",
|
|
|
|
desc = "Select inner part of a parameter region"
|
|
|
|
},
|
|
|
|
["af"] = {
|
|
|
|
query = "@function.outer",
|
|
|
|
desc = "Select a function block"
|
|
|
|
},
|
|
|
|
["if"] = {
|
|
|
|
query = "@function.inner",
|
|
|
|
desc = "Select inner part of a function"
|
|
|
|
},
|
|
|
|
["ac"] = {
|
|
|
|
query = "@class.outer",
|
|
|
|
desc = "Select a class block"
|
|
|
|
},
|
|
|
|
["ic"] = {
|
|
|
|
query = "@class.inner",
|
|
|
|
desc = "Select inner part of a class"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
|
|
goto_next_start = {
|
|
|
|
["]m"] = {
|
|
|
|
query = "@function.outer",
|
|
|
|
desc = "Jump to next function",
|
|
|
|
},
|
|
|
|
["])"] = {
|
|
|
|
query = "@class.outer",
|
|
|
|
desc = "Jump to next class",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
goto_next_end = {
|
|
|
|
["]M"] = {
|
|
|
|
query = "@function.outer",
|
|
|
|
desc = "Jump after next function",
|
|
|
|
},
|
|
|
|
["]]"] = {
|
|
|
|
query = "@class.outer",
|
|
|
|
desc = "Jump after next class",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
goto_previous_start = {
|
|
|
|
["[m"] = {
|
|
|
|
query = "@function.outer",
|
|
|
|
desc = "Jump to previous function",
|
|
|
|
},
|
|
|
|
["[)"] = {
|
|
|
|
query = "@class.outer",
|
|
|
|
desc = "Jump to previous class",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
goto_previous_end = {
|
|
|
|
["[M"] = {
|
|
|
|
query = "@function.outer",
|
|
|
|
desc = "Jump after previous function",
|
|
|
|
},
|
|
|
|
["[]"] = {
|
|
|
|
query = "@class.outer",
|
|
|
|
desc = "Jump after previous class",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
swap = {
|
|
|
|
enable = true,
|
|
|
|
swap_next = {
|
|
|
|
["<leader>a"] = {
|
|
|
|
query = "@parameter.inner",
|
|
|
|
desc = "Swap with next parameter",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
swap_previous = {
|
|
|
|
["<leader>A"] = {
|
|
|
|
query = "@parameter.inner",
|
|
|
|
desc = "Swap with previous parameter",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-05-24 20:03:39 +02:00
|
|
|
}
|