[NVIM] Add WSL clipboard
This commit was merged in pull request #1.
This commit is contained in:
@@ -244,6 +244,24 @@ nmap <Leader>t :call TextWrapToggle()<CR>
|
||||
"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 -'}
|
||||
|
||||
Reference in New Issue
Block a user