dotfiles/vim/lua/treesitter_config.lua

94 lines
2.1 KiB
Lua
Raw Normal View History

require 'nvim-treesitter.configs'.setup {
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 = '?',
},
}
}
require'treesitter-context'.setup{
enable = true,
}