From 5144c74839629dd6e40fbc996c9620771356fcc7 Mon Sep 17 00:00:00 2001 From: afonso Date: Fri, 11 Oct 2024 15:13:51 +0100 Subject: [PATCH] [nvim] mini.ai and treesitter-textobjects --- .config/nvim/lua/plugins/treesitter.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index c18f162..01f74f7 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -38,6 +38,18 @@ return { 'echasnovski/mini.ai', event = "VeryLazy", version = false, - opts = {} + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects' + }, + config = function() + local gen_spec = require('mini.ai').gen_spec + require('mini.ai').setup({ + custom_textobjects = { + -- Function definition (needs treesitter queries with these captures) + F = gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }), + }, + n_lines = 1000 + }) + end }, }