From 86de423ef029abd085531e18b197a5f90e201d98 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 21:00:32 +0200 Subject: [PATCH] fix(treesitter): dont enable ]c, [c, ... in diff-mode --- lua/lazyvim/plugins/treesitter.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index f6d36519..753cfb7d 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -10,6 +10,18 @@ return { dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", + config = function() + -- Disable class keymaps in diff mode + vim.api.nvim_create_autocmd("BufReadPost", { + callback = function(event) + if vim.wo.diff then + for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do + pcall(vim.keymap.del, "n", key, { buffer = event.buf }) + end + end + end, + }) + end, }, }, cmd = { "TSUpdateSync" },