4 changed files with 29 additions and 2 deletions
@ -1,2 +1,3 @@
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins |
||||
-- early setup: make sure custom clipboard OSC 52 is registered first, options.lua manages default registry |
||||
require("config.clipboard") |
||||
require("config.lazy") |
||||
|
||||
@ -0,0 +1,22 @@
|
||||
-- ~/.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, |
||||
}, |
||||
} |
||||
@ -1,3 +1,4 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup |
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua |
||||
-- Add any additional options here |
||||
vim.opt.clipboard = "unnamedplus" |
||||
|
||||
Loading…
Reference in new issue