go.nvim/lua/go/ts/textobjects.lua
2022-05-12 00:59:21 +10:00

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