Closed desilinguist closed 2 years ago
Something I just noticed: yy
does copy because I see the message from osc52 when I do it. It's just the paste with p
that doesn't work.
When you set vim.opt.clipboard = "unnamedplus"
, you instruct Neovim to put all your yanked text into the +
register, which in turn calls the copy()
function with the given text. But Neovim still puts the text into your unnamed register "
as well. So when you copy text inside Neovim then use p
, it should work fine. Did you remap y
or yy
in your config?
Or did you mean copying text from outside Neovim and pasting inside with p
? Unfortunately this case is not supported by most terminal emulators, because letting applications read the clipboard is a security issue. In that case I suggest you use the plugin only to copy, and use your default clipboard provider for pasting. So if you want to copy with <leader>c
:
vim.opt.clipboard = 'unnamedplus'
vim.keymap.set('n', '<leader>c', require('osc52').copy_operator, {expr = true})
vim.keymap.set('n', '<leader>cc', '<leader>c_', {remap = true})
vim.keymap.set('x', '<leader>c', require('osc52').copy_visual)
Also note that if you don't change any of the default options, you don't need to call setup()
.
I've updated the README to address your question, but you can re-open this issue if you still have problems.
I was actually referring to text copied from inside neovim and pasting inside neovim. I already use Kitty's keybinding to paste from external applications. Thanks for suggesting that there may be a conflicting remap ... I removed whichkey
from my plugin list and yy+p works again! So, whichkey must be remapping it somehow.
I think this issue may be related: https://github.com/folke/which-key.nvim/issues/202
Yes, indeed. If I fix my local copy of whichkey with the fix suggested in the above issue, yy+p within neovim works fine and so does the integration with the system clipboard. Thanks again for your help!
Good to know! Glad that your problem is resolved.
Thank you for making a great plugin! It's so great to be able to copy text even over an ssh session!
However, after setting up the plugin, I have noticed that my usual workflow of copying and pasting lines (
yy
andp
) no longer works. I get the error:I have set the following in my config:
Is there anything I can do to re-enable my copy-line-and-paste workflow? I am new to Neovim so apologies if I am missing something obvious.