go.nvim/lua/go/ts/textobjects.lua
2021-12-11 14:56:08 +11:00

39 lines
798 B
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 = {
['af'] = { go = '@function.outer' },
['if'] = { go = '@function.inner' },
['ac'] = { go = '@comment.outer' },
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']]'] = { go = '@function.outer' },
},
goto_previous_start = {
['[['] = { go = '@function.outer' },
},
},
},
}
end
return M