-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoscyank.lua
More file actions
23 lines (22 loc) · 610 Bytes
/
oscyank.lua
File metadata and controls
23 lines (22 loc) · 610 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
return {
"ojroques/vim-oscyank",
init = function()
---@diagnostic disable-next-line: inject-field
vim.g.oscyank_trim = 0
end,
config = function()
-- Single autocmd with a combined callback function
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
-- Handle both default and '+' register cases in a single function
if vim.v.event.operator ~= "y" then
return
end
local register = vim.v.event.regname
if register == "" or register == "+" then
vim.cmd(string.format("OSCYankRegister %s", register == "" and '"' or "+"))
end
end,
})
end,
}