Closed redstreet closed 1 year ago
It looks like yy
on the local machine is being provided by some other mechanism, and not osc52
. If I uninstall the nvim-osc52
plugin, local copy-to-clipboard-on-yy
still continues to work.
Perhaps nvim
can directly access the local machine's clipboard somehow, and yy
yanks into such a clipboard? Pointers as to what exactly is happening and what the relevant nvim settings are would be most appreciated :). :set clipboard
doesn't seem to be relevant. Thank you!
Hello! Could you provide your Neovim config?
Great question. That made me hunt down all the nested .vim
files I've collected over the years, where I found this little gem:
" WSL yank support
let s:clip = '/mnt/c/Windows/System32/clip.exe'
if executable(s:clip)
augroup WSLYank
autocmd!
autocmd TextYankPost * if v:event.operator ==# 'y' | call system(s:clip, @0) | endif
augroup END
endif
Given the clip.exe
, that explains why the yank-to-clipboard was working locally but not remotely.
For anyone who is interested, I removed it and replaced it with the following so that behavior works from anywhere now via nvim-osc52:
-- yy, yw, yiW, y<motion> will yank to system clipboard. cw or dw won't
api.nvim_create_autocmd("TextYankPost", {
callback = function()
if vim.v.event.operator == 'y' and vim.v.event.regname == '' then
require('osc52').copy_register('0')
vim.highlight.on_yank{higroup="IncSearch", timeout=100}
end
end
})
Apologies for wasting your time, and thanks a ton for replying and setting me on the right direction. And thanks a ton for writing and sharing nvim-osc52
!
Good to know it works now !
Here is a strange problem I could use help with from the good folks here. I'm using nvim-osc52 with nvim 0.7.2.
Config:
osc52
plugin enabled,g:clipboard
set as shown at the bottom here (I don't use the leader mappings, but use everything else):set clipboard=
is empty (not set)Ctrl+V
into Notepad)Behavior on a local machine <-- This is exactly the desired behavior
yy
and"*yy
both yank to clipboardcW
does not yank to clipboardBehavior on a remote machine (via ssh or mosh):
yy
does not yank to clipboard <-- This is the problem"*yy
yanks to clipboardcW
does not yank to clipboardNote that if I
:set clipboard=unnamed
, the behavior changes:yy
works on the remote, butcW
also copies to the clipboard (on both local and remote), which is not what I want.Any idea at all what this could be or even how I could debug it? Thanks much in advance!