Skip to content

fix: manually bind textobject select keymaps - #153

Open
patrickcchenn wants to merge 1 commit into
ThePrimeagen:masterfrom
patrickcchenn:patch-1
Open

fix: manually bind textobject select keymaps#153
patrickcchenn wants to merge 1 commit into
ThePrimeagen:masterfrom
patrickcchenn:patch-1

Conversation

@patrickcchenn

Copy link
Copy Markdown

Problem

af / if text object selection stopped working. The
nvim-treesitter-textobjects config was using the old select.keymaps
table, which was removed in the plugin's main branch rewrite. Config key is silently ignored — no error, but no keymaps either.

Fix

  • Drop enable/keymaps from setup() (no longer valid options).
  • Bind af/if manually via require("nvim-treesitter-textobjects.select").select_textobject(...),
    as required by the new API.

Copilot AI lite review requested due to automatic review settings August 24, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change matches the new plugin API and is functionally straightforward, with only a minor naming nit noted.

Pull request overview

Updates the nvim-treesitter-textobjects configuration to restore af / if function textobject selection after the plugin’s API rewrite, by removing deprecated config keys and binding the keymaps explicitly.

Changes:

  • Removes deprecated select.enable and select.keymaps options from nvim-treesitter-textobjects.setup().
  • Adds manual af / if mappings that call require("nvim-treesitter-textobjects.select").select_textobject(...).
File summaries
File Description
lua/theprimeagen/lazy/treesitter.lua Drops removed config keys and manually binds af/if using the new textobjects selection API.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +54 to +61
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants