Closed lispercat closed 2 months ago
Looks like I solved it by just replacing all of that config with:
vim.api.nvim_create_autocmd("TextYankPost", { callback = function() if vim.v.event.operator == "y" then local content = vim.fn.getreg('"') require("osc52").copy(content) end end, })
Good to know!
Strange, it only started to happen lately, maybe some lazy nvim plugins get in the way. I have following lines in my init.lua
vim.opt.clipboard = "unnamedplus" local function copy(lines, _) require("osc52").copy(table.concat(lines, "\n")) end
local function paste() return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") } end
vim.g.clipboard = { name = "osc52", copy = { ["+"] = copy, [""] = copy }, paste = { ["+"] = paste, [""] = paste }, }
So normally when I yank lines in a buffer they automatically get copies to the clipboard.
Now when I start nvim the osc52 doesn't work, so I need to evaluate init.lua for the second time, then it starts to work. On the other hand require('osc52').copy(text) functionality is there from the first nvim load.
I wonder if you may have some idea what may get in the way of that.