diff --git a/nvim/init.vim b/nvim/init.vim index b9fa290..cc68530 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -244,6 +244,24 @@ nmap t :call TextWrapToggle() "Copying if !exists('g:vscode') lua << EOF +local uname = vim.loop.os_uname() +_G.OS = uname.sysname +local IS_LINUX = _G.OS == 'Linux' +_G.IS_WSL = IS_LINUX and uname.release:lower():find 'microsoft' and true or false +if _G.IS_WSL then +vim.g.clipboard = { + name = 'WslClipboard', + copy = { + ['+'] = 'clip.exe', + ['*'] = 'clip.exe', + }, + paste = { + ['+'] = 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + ['*'] = 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + }, + cache_enabled = 0, + } +else vim.g.clipboard = { name = 'OSC 52', copy = { @@ -255,6 +273,7 @@ vim.g.clipboard = { ['*'] = require('vim.ui.clipboard.osc52').paste('*'), }, } +end if vim.env.TMUX ~= nil then local copy = {'tmux', 'load-buffer', '-w', '-'} local paste = {'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -'}