From 58659399ea161bffeca4c94256ab4aa9ec484a6a Mon Sep 17 00:00:00 2001 From: wires Date: Sat, 8 Mar 2025 07:41:31 -0500 Subject: [PATCH] add treesitter textobjects --- lazy-lock.json | 2 +- lua/plugins/treesitter.lua | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 14b4a17..0b67671 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,7 +9,6 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "cosmic-ui": { "branch": "main", "commit": "ab7de388576eaac02ce7bc2389e55b8e207aad12" }, - "dashboard-nvim": { "branch": "master", "commit": "000448d837f6e7a47f8f342f29526c4d7e49e9ce" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, @@ -27,6 +26,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "84e0cd5a3c58e88ef706fdf4a1eed59ded1d3ce2" }, "nvim-treesitter": { "branch": "master", "commit": "55c5c762fee2e813b4e43bbfaf5b91d182bd2875" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "143856b1cee509a190cc8c17ddb0638002171235" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index f2fe648..b89c4e8 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -29,6 +29,16 @@ local config = { highlight_definitions = { enable = true }, highlight_current_scope = { enable = false }, }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + }, + }, + }, } return { @@ -37,13 +47,14 @@ return { 'windwp/nvim-ts-autotag', 'JoosepAlviste/nvim-ts-context-commentstring', 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', }, event = 'BufEnter', build = ':TSUpdate', config = function() require('nvim-treesitter.configs').setup(config) - require('ts_context_commentstring').setup { + require('ts_context_commentstring').setup({ enable_autocmd = false, - } + }) end, }