Added actions.opts.use_sys_clipboard, [issue: 789 ] (#1141)
This commit is contained in:
@@ -212,9 +212,15 @@ function M.print_clipboard()
|
||||
end
|
||||
|
||||
local function copy_to_clipboard(content)
|
||||
vim.fn.setreg("+", content)
|
||||
vim.fn.setreg('"', content)
|
||||
return a.nvim_out_write(string.format("Copied %s to system clipboard! \n", content))
|
||||
if M.use_sys_clipboard == true then
|
||||
vim.fn.setreg("+", content)
|
||||
vim.fn.setreg('"', content)
|
||||
return a.nvim_out_write(string.format("Copied %s to system clipboard! \n", content))
|
||||
else
|
||||
vim.fn.setreg('"', content)
|
||||
vim.fn.setreg("1", content)
|
||||
return a.nvim_out_write(string.format("Copied %s to neovim clipboard \n", content))
|
||||
end
|
||||
end
|
||||
|
||||
function M.copy_filename(node)
|
||||
@@ -234,4 +240,8 @@ function M.copy_absolute_path(node)
|
||||
return copy_to_clipboard(content)
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
M.use_sys_clipboard = opts.actions.use_sys_clipboard
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user