lazyvim/lua/lazyvim/plugins
Thomas Vandal 42c9f7152b
feat(treesitter): support query table in treesitter-textobjects mappings (#6736)
## Description

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

`treesitter-textobjects` mappings accept a table query (for the "move"
mappings, at least, I haven't checked the others). Currently, in
LazyVim, using a table causes an error due to the assumption that
`query` is a string in the `config` function that creates the keymap
description. This PR adds a simple loop to gather the queries from a
table and join them with "or" in the description.

Here is an example config and the resulting error. Everything works as
expected with the PR and string (single) queries still behave as
expected.

```lua
  {
    "nvim-treesitter/nvim-treesitter-textobjects",
    opts = {
      move = {
        keys = {
          goto_next_start = { ["]j"] = { "@function.outer", "@class.outer" } },
          goto_next_end = { ["]J"] = { "@function.outer", "@class.outer" } },
          goto_previous_start = { ["[j"] = { "@function.outer", "@class.outer" } },
          goto_previous_end = { ["[J"] = { "@function.outer", "@class.outer" } },
        },
      },
    },
  }
```

```lua
Failed to run `config` for nvim-treesitter-textobjects

...vim-local/opt/LazyVim/lua/lazyvim/plugins/treesitter.lua:174: attempt to call method 'gsub' (a nil value)

# stacktrace:
  - repos/nvim-local/opt/LazyVim/lua/lazyvim/plugins/treesitter.lua:174
  - vim/shared.lua:0 _in_ **tbl_map**
  - repos/nvim-local/opt/LazyVim/lua/lazyvim/plugins/treesitter.lua:197 _in_ **config**
```



## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2025-11-03 07:51:07 +01:00
..
extras feat(snacks): snacks.gh integration. Enabled by default, unless the util.octo extra is enabled. 2025-11-01 13:41:53 +01:00
lsp fix(lsp.keymaps): make cond -> enabled work again. Closes #6697 2025-10-26 12:21:22 +01:00
coding.lua docs: improved plugin doc strings (#5657) 2025-09-17 11:17:32 +02:00
colorscheme.lua fix(catppuccin): follow-up on api change (#6505) 2025-09-26 06:36:14 +02:00
editor.lua fix(keymap): remove select mode remaps of printable characters (#6296) 2025-10-20 00:10:08 -07:00
formatting.lua fix(keymap): remove select mode remaps of printable characters (#6296) 2025-10-20 00:10:08 -07:00
init.lua style: remove some vim.lsp calls during startup 2025-10-26 16:04:45 +01:00
linting.lua docs: improved plugin doc strings (#5657) 2025-09-17 11:17:32 +02:00
treesitter.lua feat(treesitter): support query table in treesitter-textobjects mappings (#6736) 2025-11-03 07:51:07 +01:00
ui.lua docs: improved plugin doc strings (#5657) 2025-09-17 11:17:32 +02:00
util.lua fix(terminal): term toggle keymaps now only work for snacks terminals. Closes #6573 2025-10-09 22:08:13 +02:00
xtras.lua feat(extras): automatically update lazyvim.json for renamed or deprecated extras 2025-10-20 08:46:45 +02:00