nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects

Per mapping/object options

Open
#156 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Tree-sitter Query
Stars
2.8k
Forks
271
Avg merge
8d 8h
Merged PRs (30d)
1

Description

Features like https://github.com/nvim-treesitter/nvim-treesitter-textobjects/pull/150 and https://github.com/nvim-treesitter/nvim-treesitter-textobjects/issues/125 would benefit from being per-mapping/objects instead of global options.

Our current settings look like this

      keymaps = {
        ["af"] = "@function.outer",
        ["if"] = "@function.inner",
        ["ac"] = "@class.outer",
        ["ic"] = "@class.inner",
      }

We could extend them to something like

-- Global options are defined here
-- lookahead = true,
keymaps = {
  ["af"] = {
    textobject = "@function.outer",
    -- If these options aren't given the global/default ones
    -- are used.
    lookahead = true,
    auto_expand = true,
  },
  -- This form is valid, and it uses the global options.
  ["if"] = "@function.inner"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing keymap and global-option handling in the plugin, then compare it with the linked textobjects pull request and issue. Define how per-mapping values override defaults while preserving the string form, and verify both forms and fallback behavior with the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.