You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
517 B

-- ~/.config/nvim/lua/config/clipboard.lua
local function osc52_copy(lines)
local data = table.concat(lines, "\n")
local b64 = vim.fn.system("base64 -w0", data)
vim.fn.chansend(vim.v.stderr, "\x1b]52;c;" .. b64 .. "\x07")
end
vim.g.clipboard = {
name = "OSC 52",
copy = {
["+"] = osc52_copy,
["*"] = osc52_copy,
},
paste = {
["+"] = function()
return vim.split(vim.fn.getreg("+"), "\n")
end,
["*"] = function()
return vim.split(vim.fn.getreg("*"), "\n")
end,
},
}