jodidos.com
jodidos.com

Reputation: 43

Error running win32yank in neovim, Invalid value for argument cmd: win32yank.exe

I have a problem and it is that I put win32yank in my nvim configuration to share the clipboard, the bad thing is that it gives me the following error:

Error detected while processing function provider#clipboard#Call[6]..3[15]..<SNR>25_try_cmd:
line    1:
E475: Invalid value for argument cmd: 'win32yank.exe' is not executable

Maybe the error may be in lua, or ubuntu, if you could tell me a way to test the win32yank from the terminal and know that it is not the problem, it would help me a lot

You can also see it in the following screenshot

enter image description here

this happens when I try to copy something in neovim

this is my neovim configuration, in this case i passed it to lua, but it is practically the same:

local o = vim.o
local wo = vim.wo

wo.nu = true
wo.rnu = true
o.clipboard = "unnamedplus"

o.expandtab = true
o.tabstop = 4
o.shiftwidth = 4

vim.g.clipboard = {
    name = "win32yank-wsl",
    copy = {
         ["+"] = "win32yank.exe -i --crlf",
         ["*"] = "win32yank.exe -i --crlf"
    },
    paste = {
        ["+"] = "win32yank.exe -o --lf",
        ["*"] = "win32yank.exe -o --lf"
    },
    cache_enabled = false
}

enter image description here Also to clarify everything, download the win32yank, just as I did to configure it with my previous version of neovim, and use the following command:

sudo ln -s ~/.config/nvim/win32yank.exe /usr/bin/win32yank

which when executing it did not give me any error you can see that my win32yank is in the nvim folder of .config, as in the ln command enter image description here

I also add my checkhealth to see that the clipboard is supposedly fine enter image description here

Upvotes: 1

Views: 4820

Answers (2)

DieOde
DieOde

Reputation: 151

I use WSL neovim everyday, and it works great.

In addition to Ethan A's reply I have some to add.

The only think you should have to do is the download the win32yank.exe, move to the correct place of your install as described.

But I do set the vim.o.clipboard in my config like so:

vim.o.clipboard = 'unnamedplus'

Copy paste between vim and everything else (for WSL clipboard usage).

And that should be it. Delete all your other config stuff with the clipboard as it should be unneeded.

Upvotes: 0

Ethan A.
Ethan A.

Reputation: 71

I would look at Neovim's FAQ, it has information which fixed my issue.

First check if you are able to execute your win32yank.exe from the command line; you should see a usage statement. If you don't see it, you might want to use the win32yank version that comes in Window's Neovim install.

However in my case, running this fixed things (with ~/bin being in my $PATH):

curl -sLo/tmp/win32yank.zip https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip
unzip -p /tmp/win32yank.zip win32yank.exe > /tmp/win32yank.exe
chmod +x /tmp/win32yank.exe
mv /tmp/win32yank.exe ~/bin

After doing this, you shouldn't need to set the vim.g.clipboard variable.

Sorry if this is not very helpful, this is one of my first posts.👍

Upvotes: 3

Related Questions