2023-09-19 05:21:43 +00:00
|
|
|
require("nvim-treesitter.configs").setup({
|
2023-09-22 12:26:13 +00:00
|
|
|
-- TODO: only install needed
|
2023-09-19 05:21:43 +00:00
|
|
|
ensure_installed = "all",
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
disable = { "vim", "swift" },
|
|
|
|
additional_vim_regex_highlighting = true,
|
|
|
|
},
|
|
|
|
incremental_selection = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
indent = {
|
|
|
|
-- enabling breaks autoindent:
|
|
|
|
enable = false,
|
|
|
|
},
|
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
|
|
|
["ak"] = "@keyed_element.outer",
|
|
|
|
["av"] = "@keyed_element.inner",
|
|
|
|
["ia"] = "@parameter.inner",
|
|
|
|
["aa"] = "@parameter.outer",
|
|
|
|
["ac"] = "@comment.outer",
|
|
|
|
["at"] = "@statement.outer",
|
|
|
|
["ar"] = "@return",
|
|
|
|
["af"] = "@function.outer",
|
|
|
|
["if"] = "@function.inner",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
set_jumps = true,
|
|
|
|
goto_next_start = {
|
|
|
|
["]a"] = "@parameter.inner",
|
|
|
|
["]f"] = "@function.outer",
|
|
|
|
["]F"] = "@function.inner",
|
|
|
|
},
|
|
|
|
goto_previous_start = {
|
|
|
|
["[a"] = "@parameter.inner",
|
|
|
|
["[f"] = "@function.outer",
|
|
|
|
["[F"] = "@function.inner",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lsp_interop = {
|
|
|
|
enable = true,
|
|
|
|
peek_definition_code = {
|
|
|
|
["<leader>d"] = "@class.outer",
|
|
|
|
-- ["<leader>d"] = "@function.outer",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
refactor = {
|
|
|
|
highlight_definitions = { enable = true },
|
|
|
|
highlight_current_scope = { enable = false },
|
|
|
|
smart_rename = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
smart_rename = "grr",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
navigation = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
-- goto_definition_lsp_fallback = "gd",
|
|
|
|
goto_next_usage = "]r",
|
|
|
|
goto_previous_usage = "[r",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
playground = {
|
|
|
|
enable = true,
|
|
|
|
disable = {},
|
|
|
|
updatetime = 25,
|
|
|
|
persist_queries = false,
|
|
|
|
keybindings = {
|
|
|
|
toggle_query_editor = "o",
|
|
|
|
toggle_hl_groups = "i",
|
|
|
|
toggle_injected_languages = "t",
|
|
|
|
toggle_anonymous_nodes = "a",
|
|
|
|
toggle_language_display = "I",
|
|
|
|
focus_language = "f",
|
|
|
|
unfocus_language = "F",
|
|
|
|
update = "R",
|
|
|
|
goto_node = "<cr>",
|
|
|
|
show_help = "?",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2023-09-17 20:44:10 +00:00
|
|
|
|
2023-09-19 05:21:43 +00:00
|
|
|
require("treesitter-context").setup({
|
|
|
|
enable = true,
|
|
|
|
})
|