mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-03-10 01:17:25 +00:00
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:
committed by
GitHub
parent
92607e79e0
commit
16713e6e12
@@ -180,15 +180,16 @@ 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()
|
||||
require("nvim-treesitter-textobjects.move")[method](query, "textobjects")
|
||||
end, {
|
||||
buffer = buf,
|
||||
desc = desc,
|
||||
silent = true,
|
||||
})
|
||||
end
|
||||
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,
|
||||
desc = desc,
|
||||
silent = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user