Skip to content

Commit

Permalink
chore(wsl): use Windows native way to yank and paste. (ayamir#736)
Browse files Browse the repository at this point in the history
* chore(wsl): use Windows native way to yank and paste.

* style: update code style.

Co-authored-by: 冷酔閑吟 <[email protected]>

---------

Co-authored-by: 冷酔閑吟 <[email protected]>
  • Loading branch information
2 people authored and singlemancombat committed May 16, 2023
1 parent bb722ca commit 8bf8b84
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lua/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,27 @@ local neovide_config = function()
end

local clipboard_config = function()
if global.is_mac then
vim.g.clipboard = {
name = "macOS-clipboard",
copy = { ["+"] = "pbcopy", ["*"] = "pbcopy" },
paste = { ["+"] = "pbpaste", ["*"] = "pbpaste" },
cache_enabled = 0,
}
elseif global.is_wsl then
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 = 0,
}
end
if global.is_mac then
vim.g.clipboard = {
name = "macOS-clipboard",
copy = { ["+"] = "pbcopy", ["*"] = "pbcopy" },
paste = { ["+"] = "pbpaste", ["*"] = "pbpaste" },
cache_enabled = 0,
}
elseif global.is_wsl then
vim.g.clipboard = {
name = "psyank-wsl",
copy = {
["+"] = "clip.exe",
["*"] = "clip.exe",
},
paste = {
["+"] = [[powershell.exe -NoProfile -NoLogo -NonInteractive -MTA -Command [console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))]],
["*"] = [[powershell.exe -NoProfile -NoLogo -NonInteractive -MTA -Command [console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))]],
},
cache_enabled = 0,
}
end
end

local shell_config = function()
Expand Down

0 comments on commit 8bf8b84

Please sign in to comment.