summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/basics.lua1
-rw-r--r--plugin/clipboard.lua22
2 files changed, 22 insertions, 1 deletions
diff --git a/lua/basics.lua b/lua/basics.lua
index 38576c3..66e53fa 100644
--- a/lua/basics.lua
+++ b/lua/basics.lua
@@ -10,7 +10,6 @@ local cache_dir = os.getenv('HOME') .. '/.cache/nvim/'
-- General
-----------------------------------------------------------
opt.mouse = 'a' -- Enable mouse support
-opt.clipboard = 'unnamedplus' -- Copy/paste to system clipboard
opt.swapfile = false -- Don't use swapfile
opt.completeopt = 'menuone,noinsert,noselect' -- Autocomplete options
opt.history = 500 -- Lines vim should remember
diff --git a/plugin/clipboard.lua b/plugin/clipboard.lua
new file mode 100644
index 0000000..853939e
--- /dev/null
+++ b/plugin/clipboard.lua
@@ -0,0 +1,22 @@
+local opt = vim.opt
+
+opt.clipboard = "unnamedplus"
+
+if vim.env.SSH_CONNECTION then
+ local function vim_paste()
+ local content = vim.fn.getreg '"'
+ return vim.split(content, "\n")
+ end
+
+ vim.g.clipboard = {
+ name = "OSC 52",
+ copy = {
+ ["+"] = require("vim.ui.clipboard.osc52").copy "+",
+ ["*"] = require("vim.ui.clipboard.osc52").copy "*",
+ },
+ paste = {
+ ["+"] = vim_paste,
+ ["*"] = vim_paste,
+ },
+ }
+end