diff --git a/init.lua b/init.lua index a74f1a3..82a9d57 100644 --- a/init.lua +++ b/init.lua @@ -112,7 +112,31 @@ require'nvim-treesitter.configs'.setup { max_file_lines = nil, -- Do not enable for files with more than n lines, int -- colors = {}, -- table of hex strings -- termcolors = {} -- table of colour name strings - } + }, + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + 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", + }, + }, + lsp_interop = { + enable = true, + border = 'none', + peek_definition_code = { + ["df"] = "@function.outer", + ["dF"] = "@class.outer", + }, + }, + }, } -------------------- LUASNIP ------------------------------- require("luasnip.loaders.from_vscode").load() diff --git a/lua/my_plugins.lua b/lua/my_plugins.lua index 2ecd20c..06b20ce 100644 --- a/lua/my_plugins.lua +++ b/lua/my_plugins.lua @@ -58,4 +58,8 @@ return require('packer').startup(function() requires = "nvim-treesitter/nvim-treesitter" } use {'abecodes/tabout.nvim'} + use { + 'nvim-treesitter/nvim-treesitter-textobjects', + requires = "nvim-treesitter/nvim-treesitter" + } end)