neovide: neovide copy/paste is not working when connect to remote neovim

i am really happy to using neovide at my workflow. before using neovide, i was a emacs user for 10 years. now, i am using neovim + lua config + neovide for 1 years.

most of my workflow i use neovide on linux x11 desktop but sometime i have to use windows for specific workload. in this situation i have following problems.

Describe the bug in Windows 10, neovide can connect to remote neovim (running on ubuntu) but, cannot paste windows clipboard, also cannot copy remote neovim’s yanked text to windows clipboard

My neovim config

vim.g.mapleader = ' '
vim.g.encoding = "utf8"

vim.cmd([[
...
set clipboard=unnamedplus
...
]])

start neovim headless with this command

ssh -L 6666:localhost:6666 jltech-lab.iptime.org -p 9022 nvim --headless --listen localhost:6666

using neovide connect to remote neovim

C:\neovide.exe --remote-tcp=localhost:6666

in neovide, yank & paste not working.

how can i make this scenario working ??

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

This seems like something OSC52 could solve. I just tried the OSCYank plugin and there seem to be some issues right out of the box. I’ll try to investigate a bit.

I think I made the clipboard work with neovide 0.10.1 . However, some massaging was required.

In my case, neovide seems to set vim.g.clipboard properly:

{
  cache_enabled = 0,
  copy = {
    ["*"] = <function 1>,
    ["+"] = <function 2>
  },
  name = "neovide",
  paste = {
    ["*"] = <function 3>,
    ["+"] = <function 4>
  }
}

However, setting vim.g.clipboard is not enough - it must be enabled by rerunning autoload/provider/clipboard.vim. I have done that by adding this lua code to UIEnter autocmd:

if vim.v.event.chan > 1 then
  if vim.g.loaded_clipboard_provider then
    vim.g.loaded_clipboard_provider = nil
    vim.api.nvim_cmd( { cmd = 'runtime', args = { 'autoload/provider/clipboard.vim' } }, {} )
  end
end