fix(treesitter): fix ]c textobject mappings when in diff mode (#6911)

## Description
It seems that after
5985ca0cf1
the default `]c` Neovim mapping in diff mode broke. This is an attempt
to fix that.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None, rather discussion #6910.
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
This commit is contained in:
Iordanis Petkakis
2026-03-01 11:11:09 +02:00
committed by GitHub
parent 92607e79e0
commit 16713e6e12

View File

@@ -180,8 +180,10 @@ return {
local desc = table.concat(parts, " or ")
desc = (key:sub(1, 1) == "[" and "Prev " or "Next ") .. desc
desc = desc .. (key:sub(2, 2) == key:sub(2, 2):upper() and " End" or " Start")
if not (vim.wo.diff and key:find("[cC]")) then
vim.keymap.set({ "n", "x", "o" }, key, function()
if vim.wo.diff and key:find("[cC]") then
return vim.cmd("normal! " .. key)
end
require("nvim-treesitter-textobjects.move")[method](query, "textobjects")
end, {
buffer = buf,
@@ -191,7 +193,6 @@ return {
end
end
end
end
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("lazyvim_treesitter_textobjects", { clear = true }),