CopilotC-Nvim / CopilotChat.nvim

Chat with GitHub Copilot in Neovim
https://copilotc-nvim.github.io/CopilotChat.nvim/
GNU General Public License v3.0
1.44k stars 67 forks source link

Diff yank with 'gy' (the default mapping) doesn't work. #364

Open marwan-tanager opened 1 month ago

marwan-tanager commented 1 month ago

Hi, I couldn't get the gy mapping to yank the diff in the chat window to work. Also, it doesn't work if I assign any other key combination to mappings.yank_diff.

sjonpaulbrown-cc commented 2 weeks ago

I was experiencing the same issue. I had my clipboard set to vim.o.clipboard = 'unnamedplus'. When commenting this out, I was able to successfully use the gy mapping.

The gy mapping stores the diff to the " register. You can validate that the diff is properly getting copied by running the :registers " command. After copying with gy, you need to validate the contents of the " register. If it is empty, you may be overwriting the register in some way.

https://github.com/CopilotC-Nvim/CopilotChat.nvim/blob/cfdf371cec954fccf5410315884e110d214d38fa/lua/CopilotChat/init.lua#L777