ray.xu 2 years ago
parent 2a2c5f4cd8
commit 50a9fe57ec

@ -1,38 +1,50 @@
local util = require 'go.utils'
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')
if not plugins("nvim-treesitter") then
util.log("treesitter not avalible")
return
end
local ts = require 'nvim-treesitter.configs'
ts.setup {
local ts = require("nvim-treesitter.configs")
ts.setup({
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['af'] = { go = '@function.outer' },
['if'] = { go = '@function.inner' },
['ac'] = { go = '@comment.outer' },
-- 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,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']]'] = { go = '@function.outer' },
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
['[['] = { go = '@function.outer' },
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
},
}
})
end
return M

Loading…
Cancel
Save