ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.82k stars 450 forks source link

Sluggish WSL clipboard communication #1251

Closed jwangtobeno1 closed 1 month ago

jwangtobeno1 commented 1 month ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

NVIM v0.9.5

Operating system/version

Arch WSL2

Terminal name/version

WSL2

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

When I use dd or x or p in nvim it gets stuck, but not when I use i or o or hjkl. It's as if it stutters whenever you use a key with a cut function.

PixPin_2024-05-06_11-27-32

But I don't get this in vim.

Expected behavior

I hope it doesn't lag when using these types of keys

Actual behavior

No response

Additional information

Here is the setup for my user:

local settings = {}

-- Examples
settings["use_ssh"] = true

settings["colorscheme"] = "catppuccin"

settings["lsp_deps"] = {
    "verible",
}

settings["null_ls_deps"] = function(defaults)
    return {
        defaults[1],
        defaults[4],
        defaults[5],
        defaults[6],
        defaults[7],
    }
end

settings["dap_deps"] = function(defaults)
    return {
        defaults[1],
        defaults[3],
    }
end

return settings
Jint-lzxy commented 1 month ago

I think this is a possible duplicate #791. The underlying issue boils down to Neovim struggling to sync up with ur clipboard server (in nvimdots, we're explicit about using win32yank.exe for WSL to sidestep other messy issues). Consequently, u might experience delays with commands reliant on accessing the system clipboard.

In essence, the previously effective fixes include:

  1. Ensuring u've got a symlink to (or a copy of) win32yank.exe located on ur host machine (the one running Windows), and it's discoverable using $PATH. i.e. u have a file on ur WSL that resembles something like:
    $ readlink /usr/local/bin/win32yank.exe
    /mnt/c/path/to/win32yank.exe
  2. Experimenting with alternative clipboard providers, as win32yank.exe might not be the optimal pick for ur setup. Then modify vim.g.clipboard to the provider u selected.
  3. Use the alternative provider specified in the manual. (See :h clipboard-wsl)
  4. Disable the global clipboard using :set clipboard& (this is the default in Vim).
jwangtobeno1 commented 1 month ago

Thank you.

The problem was solved by:

ln -s /mnt/c/path/to/win32yank.exe /usr/local/bin/win32yank.exe