Skip to content

Commit fa73a37

Browse files
committed
chore(clip): copy to clipboard on focuslost, do not send anything while unnecessary
1 parent c687104 commit fa73a37

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lua/modules.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,12 @@ autocmd("CursorHold", {
6969
end,
7070
})
7171

72+
-- Copy last yanked text to clipboard on focusLost
73+
autocmd('FocusLost', {
74+
desc = "Copy to clipboard on FocusLost",
75+
callback = function()
76+
vim.fn.setreg("+", vim.fn.getreg("0"))
77+
end,
78+
})
79+
7280
return M

lua/opts.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local opts = {}
44

55
opts.initial = function()
66
opt.laststatus = 3
7-
opt.clipboard = "unnamedplus"
7+
-- opt.clipboard = "unnamedplus"
88
opt.termguicolors = true
99
opt.fillchars:append { eob = " " }
1010
opt.shortmess:append "aIF"

0 commit comments

Comments
 (0)