diff --git a/lazy-lock.json b/lazy-lock.json index 2c62a6d..1850972 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,6 +20,7 @@ "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-lint": { "branch": "master", "commit": "d1118791070d090777398792a73032a0ca5c79ff" }, "nvim-lspconfig": { "branch": "master", "commit": "a2a277114dbb93e98f04b5087a9b832918b7da15" }, + "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, "nvim-treesitter": { "branch": "main", "commit": "bb83a676128d95c865e40ba71376d883bdadec14" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "227165aaeb07b567fb9c066f224816aa8f3ce63f" }, "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, diff --git a/lua/plugins/osc52.lua b/lua/plugins/osc52.lua new file mode 100644 index 0000000..2e1ead2 --- /dev/null +++ b/lua/plugins/osc52.lua @@ -0,0 +1,19 @@ +return { + { + "ojroques/nvim-osc52", + config = function() + require("osc52").setup({ + max_length = 0, -- Maximum length of selection (0 for no limit) + silent = false, -- Disable message on successful copy + trim = false, -- Trim surrounding whitespaces before copy + }) + local function copy() + if (vim.v.event.operator == "y" or vim.v.event.operator == "d") and vim.v.event.regname == "" then + require("osc52").copy_register("") + end + end + + vim.api.nvim_create_autocmd("TextYankPost", { callback = copy }) + end, + }, +}