2022-02-26 12:26:49 +01:00
|
|
|
local ts_config = require("nvim-treesitter.configs")
|
2024-07-19 13:13:11 +02:00
|
|
|
|
2022-02-26 12:26:49 +01:00
|
|
|
ts_config.setup({
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
-- Avoid duplicate highlighting
|
|
|
|
additional_vim_regex_highlighting = false,
|
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
enable = true,
|
|
|
|
},
|
2022-02-26 19:28:15 +01:00
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
-- Jump to matching text objects
|
|
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
2024-07-19 13:32:10 +02:00
|
|
|
["aa"] = { query = "@parameter.outer", desc = "a parameter" },
|
|
|
|
["ia"] = { query = "@parameter.inner", desc = "inner parameter" },
|
|
|
|
["ab"] = { query = "@block.outer", desc = "a block" },
|
|
|
|
["ib"] = { query = "@block.inner", desc = "inner block" },
|
|
|
|
["ac"] = { query = "@class.outer", desc = "a class" },
|
|
|
|
["ic"] = { query = "@class.inner", desc = "inner class" },
|
|
|
|
["af"] = { query = "@function.outer", desc = "a function" },
|
|
|
|
["if"] = { query = "@function.inner", desc = "inner function" },
|
|
|
|
["ak"] = { query = "@comment.outer", desc = "a comment" },
|
|
|
|
["aS"] = { query = "@statement.outer", desc = "a statement" },
|
2022-02-26 19:28:15 +01:00
|
|
|
},
|
|
|
|
},
|
2022-02-26 19:45:09 +01:00
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
-- Add to jump list
|
|
|
|
set_jumps = true,
|
|
|
|
goto_next_start = {
|
2024-07-19 13:32:10 +02:00
|
|
|
["]m"] = { query = "@function.outer", desc = "Next method start" },
|
|
|
|
["]S"] = { query = "@statement.outer", desc = "Next statement start" },
|
|
|
|
["]]"] = { query = "@class.outer", desc = "Next class start" },
|
2022-02-26 19:45:09 +01:00
|
|
|
},
|
|
|
|
goto_next_end = {
|
2024-07-19 13:32:10 +02:00
|
|
|
["]M"] = { query = "@function.outer", desc = "Next method end" },
|
|
|
|
["]["] = { query = "@class.outer", desc = "Next class end" },
|
2022-02-26 19:45:09 +01:00
|
|
|
},
|
|
|
|
goto_previous_start = {
|
2024-07-19 13:32:10 +02:00
|
|
|
["[m"] = { query = "@function.outer", desc = "Previous method start" },
|
|
|
|
["[S"] = { query = "@statement.outer", desc = "Previous statement start" },
|
|
|
|
["[["] = { query = "@class.outer", desc = "Previous class start" },
|
2022-02-26 19:45:09 +01:00
|
|
|
},
|
|
|
|
goto_previous_end = {
|
2024-07-19 13:32:10 +02:00
|
|
|
["[M"] = { query = "@function.outer", desc = "Previous method end" },
|
|
|
|
["[]"] = { query = "@class.outer", desc = "Previous class end" },
|
2022-02-26 19:45:09 +01:00
|
|
|
},
|
|
|
|
},
|
2022-02-26 19:28:15 +01:00
|
|
|
},
|
2022-02-26 12:26:49 +01:00
|
|
|
})
|