From 1724ab5be50bc96bff3db09ef34095a3035214c6 Mon Sep 17 00:00:00 2001 From: siduck Date: Sun, 31 Mar 2024 05:45:37 +0530 Subject: [PATCH] recipes: add clipboard in wsl without xclip --- src/routes/docs/recipes.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/routes/docs/recipes.mdx b/src/routes/docs/recipes.mdx index 45458cc6..71a5a9c0 100644 --- a/src/routes/docs/recipes.mdx +++ b/src/routes/docs/recipes.mdx @@ -80,3 +80,23 @@ autocmd("BufReadPost", { end, }) ``` + +## Clipboard in WSL without xclip + +- This is a WSL specific setting to use the Windows clipboard for + and * registers +- If you have the default PowerShell, substitute pwsh.exe with powershell.exe + +```lua +vim.g.clipboard = { + name = 'WslClipboard', + copy = { + ['+'] = 'clip.exe', + ['*'] = 'clip.exe', + }, + paste = { + ['+'] = 'pwsh.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + ['*'] = 'pwsh.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + }, + cache_enabled = 0, +} +```