50 lines
1.3 KiB
Lua
50 lines
1.3 KiB
Lua
return {
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
lazy = false,
|
|
branch = "master",
|
|
dependencies = {
|
|
{
|
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
|
opts = {
|
|
enable_autocmd = false,
|
|
},
|
|
},
|
|
{ "nvim-treesitter/nvim-treesitter-context" },
|
|
},
|
|
build = ":TSUpdate",
|
|
opts = {
|
|
auto_install = true,
|
|
highlight = { enable = true },
|
|
indent = { enable = true },
|
|
},
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
dependencies = { "nvim-treesitter", },
|
|
config = function()
|
|
require 'nvim-treesitter.configs'.setup({
|
|
textobjects = {
|
|
move = {
|
|
enable = true,
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
goto_next = {
|
|
["]]"] = { query = { "@block.outer", "@function.outer", "@class.outer", } },
|
|
},
|
|
goto_previous = {
|
|
["[["] = { query = { "@block.outer", "@function.outer", "@class.outer", } },
|
|
}
|
|
},
|
|
},
|
|
})
|
|
|
|
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
|
|
|
-- Repeat movement with ; and ,
|
|
-- ensure ; goes forward and , goes backward regardless of the last direction
|
|
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_previous)
|
|
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_next)
|
|
end
|
|
}
|
|
|
|
}
|