update: nvim: add tree-sitter text object

This commit is contained in:
qwjyh 2023-03-13 00:33:09 +09:00
parent d7b7044536
commit b107ad0712

View file

@ -43,6 +43,9 @@ require('lazy').setup({
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
},
})
@ -120,6 +123,49 @@ require'nvim-treesitter.configs'.setup {
indent = {
enable = true,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
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',
},
},
swap = {
enable = true,
swap_next = {
['<space>a'] = '@parameter.inner',
},
swap_previous = {
['<space>A'] = '@parameter.inner',
},
},
},
}