From a587a96a48c705609bfd2ad23f9ae5961eb0d373 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 10 Apr 2026 08:19:42 -0500 Subject: [PATCH] plugins/treesitter-textobjects: keymaps update Breaking changes recently introduced in all the nvim-treesitter rewrite. Just make it more known that the `settings` keymaps will have no effect in newer versions. --- .../treesitter-textobjects/default.nix | 16 +++++--- .../treesitter-textobjects/default.nix | 41 ------------------- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/plugins/by-name/treesitter-textobjects/default.nix b/plugins/by-name/treesitter-textobjects/default.nix index 228ed574..8a952cd7 100644 --- a/plugins/by-name/treesitter-textobjects/default.nix +++ b/plugins/by-name/treesitter-textobjects/default.nix @@ -4,18 +4,22 @@ lib.nixvim.plugins.mkNeovimPlugin { package = "nvim-treesitter-textobjects"; maintainers = [ lib.maintainers.GaetanLepage ]; + description = '' + Syntax-aware textobjects using tree-sitter. + + > [!WARNING] + > Upstream refactored this plugin so textobject keymaps are no longer configured through + > `require("nvim-treesitter.configs").setup({ textobjects = ... })`. + > Define keymaps through Neovim's keymap API instead, for example with nixvim's top-level + > `keymaps` option and calls to `require("nvim-treesitter-textobjects.")`. + ''; + # TODO: introduced 2025-10-17: remove after 26.05 inherit (import ./deprecations.nix lib) deprecateExtraOptions optionsRenamedToSettings imports; settingsExample = { enable = true; lookahead = true; - keymaps = { - ab = "@block.outer"; - ib = "@block.inner"; - ac = "@call.outer"; - ic = "@call.inner"; - }; }; callSetup = false; diff --git a/tests/test-sources/plugins/by-name/treesitter-textobjects/default.nix b/tests/test-sources/plugins/by-name/treesitter-textobjects/default.nix index ea5058bf..c979d836 100644 --- a/tests/test-sources/plugins/by-name/treesitter-textobjects/default.nix +++ b/tests/test-sources/plugins/by-name/treesitter-textobjects/default.nix @@ -17,15 +17,6 @@ enable = true; disable.__empty = { }; lookahead = true; - keymaps = { - af = "@function.outer"; - "if" = "@function.inner"; - ac = "@class.outer"; - ic = { - query = "@class.inner"; - desc = "Select inner part of a class region"; - }; - }; selection_modes = { "@parameter.outer" = "v"; "@function.outer" = "V"; @@ -36,47 +27,15 @@ swap = { enable = true; disable.__empty = { }; - swap_next = { - "a" = "@parameter.inner"; - }; - swap_previous = { - "A" = "@parameter.inner"; - }; }; move = { enable = true; disable.__empty = { }; set_jumps = true; - goto_next_start = { - "]m" = "@function.outer"; - "]]" = "@class.outer"; - }; - goto_next_end = { - "]M" = "@function.outer"; - "][" = "@class.outer"; - }; - goto_previous_start = { - "[m" = "@function.outer"; - "[[" = "@class.outer"; - }; - goto_previous_end = { - "[M" = "@function.outer"; - "[]" = "@class.outer"; - }; - goto_next = { - "]d" = "@conditional.outer"; - }; - goto_previous = { - "[d" = "@conditional.outer"; - }; }; lsp_interop = { enable = true; border = "none"; - peek_definition_code = { - "df" = "@function.outer"; - "dF" = "@class.outer"; - }; floating_preview_opts.__empty = { }; }; };