diff --git a/lua/theprimeagen/lazy/treesitter.lua b/lua/theprimeagen/lazy/treesitter.lua index 103fe07f..1c6bfba1 100644 --- a/lua/theprimeagen/lazy/treesitter.lua +++ b/lua/theprimeagen/lazy/treesitter.lua @@ -47,14 +47,18 @@ return { config = function() require("nvim-treesitter-textobjects").setup({ select = { - enable = true, lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - }, }, }) + + local select = require("nvim-treesitter-textobjects.select") + + vim.keymap.set({ "x", "o" }, "af", function() + select.select_textobject("@function.outer", "textobjects") + end) + vim.keymap.set({ "x", "o" }, "if", function() + select.select_textobject("@function.inner", "textobjects") + end) end, }, }