You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.2 KiB
Lua
94 lines
2.2 KiB
Lua
local treesitter_config_setup = {
|
|
-- Add languages to be installed here that you want installed for treesitter
|
|
ensure_installed = {
|
|
'bash', 'c', 'cpp', 'go', 'lua', 'python', 'rust',
|
|
'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
|
|
},
|
|
|
|
auto_install = true,
|
|
sync_install = false,
|
|
|
|
modules = {},
|
|
ignore_install = {},
|
|
|
|
highlight = { enable = true },
|
|
indent = { enable = true },
|
|
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = '<c-space>',
|
|
node_incremental = '<c-space>',
|
|
scope_incremental = '<c-s>',
|
|
node_decremental = '<M-space>',
|
|
},
|
|
},
|
|
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
-- Automatically jump forward to textobj, similar to targets.vim
|
|
lookahead = true,
|
|
keymaps = {
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
['aa'] = '@parameter.outer',
|
|
['ia'] = '@parameter.inner',
|
|
['af'] = '@function.outer',
|
|
['if'] = '@function.inner',
|
|
['ac'] = '@class.outer',
|
|
['ic'] = '@class.inner',
|
|
},
|
|
},
|
|
|
|
swap = {
|
|
enable = true,
|
|
swap_next = {
|
|
['<leader>a'] = '@parameter.inner',
|
|
},
|
|
swap_previous = {
|
|
['<leader>A'] = '@parameter.inner',
|
|
},
|
|
},
|
|
|
|
move = {
|
|
enable = true,
|
|
-- whether to set jumps in the jumplist
|
|
set_jumps = true,
|
|
goto_next_start = {
|
|
[']m'] = '@function.outer',
|
|
[']]'] = '@class.outer',
|
|
},
|
|
goto_next_end = {
|
|
[']M'] = '@function.outer',
|
|
[']['] = '@class.outer',
|
|
},
|
|
goto_previous_start = {
|
|
['[m'] = '@function.outer',
|
|
['[['] = '@class.outer',
|
|
},
|
|
goto_previous_end = {
|
|
['[M'] = '@function.outer',
|
|
['[]'] = '@class.outer',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
local function treesitter_configs()
|
|
require('nvim-treesitter.configs').setup(treesitter_config_setup)
|
|
end
|
|
|
|
local function config()
|
|
vim.defer_fn(treesitter_configs, 0)
|
|
end
|
|
|
|
return {
|
|
-- Highlight, edit, and navigate code
|
|
'nvim-treesitter/nvim-treesitter',
|
|
config = config,
|
|
build = ':TSUpdate',
|
|
dependencies = {
|
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
},
|
|
}
|