dotfiles/vim/lua/treesitter_config.lua

114 lines
2.2 KiB
Lua
Raw Normal View History

2023-09-19 05:21:43 +00:00
require("nvim-treesitter.configs").setup({
2023-10-04 20:38:50 +00:00
ensure_installed = {
"bash",
"dockerfile",
"go",
"gomod",
"gosum",
"html",
"javascript",
2024-01-21 14:19:20 +00:00
"typescript",
2023-10-04 20:38:50 +00:00
"json",
"lua",
"make",
"python",
"ruby",
"rust",
"sql",
},
sync_install = true,
auto_install = false,
ignore_install = {},
2023-09-19 05:21:43 +00:00
highlight = {
enable = true,
disable = { "vim", "swift" },
additional_vim_regex_highlighting = true,
},
incremental_selection = {
2023-10-04 20:38:50 +00:00
enable = false,
2023-09-19 05:21:43 +00:00
},
indent = {
-- enabling breaks autoindent:
enable = false,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["ak"] = "@keyed_element.outer",
2023-10-22 05:55:58 +00:00
["iv"] = "@keyed_element.inner",
2023-09-19 05:21:43 +00:00
["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-19 05:21:43 +00:00
require("treesitter-context").setup({
enable = true,
})