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.
go.nvim/lua/go/ts/textobjects.lua

46 lines
1.0 KiB
Lua

local util = require("go.utils")
local plugins = util.load_plugin
local M = {}
function M.setup()
if not plugins("nvim-treesitter") then
util.log("treesitter not avalible")
return
end
require("nvim-treesitter.configs").setup({
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]]"] = "@function.outer",
},
goto_next_end = {
["]["] = "@function.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
},
},
},
})
end
return M