51 lines
1.2 KiB
Lua
51 lines
1.2 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
|
|
|
|
local ts = require("nvim-treesitter.configs")
|
|
ts.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 = {
|
|
["]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",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end
|
|
|
|
return M
|