Skip to content

Commit abac984

Browse files
committed
improve clipboard support
1 parent 9936f43 commit abac984

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

init.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ vim.opt.scrolloff = 10
1414
vim.opt.colorcolumn = '120'
1515
-- vim.opt.breakindent = true
1616

17-
-- Sync clipboard between OS and Neovim.
18-
vim.schedule(function()
19-
vim.opt.clipboard = 'unnamedplus'
20-
end)
21-
vim.opt.mouse = 'nvi'
17+
-- TODO: replace with osc52 provider once iTerm2 supports it better
18+
if vim.env.DISPLAY then
19+
if vim.fn.executable 'xclip' == 1 then
20+
vim.schedule(function()
21+
vim.opt.clipboard:append { 'unnamed', 'unnamedplus' }
22+
end)
23+
end
24+
vim.opt.mouse = 'nvi'
25+
end
2226

2327
-- File related
2428
vim.opt.autochdir = false

0 commit comments

Comments
 (0)