summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrahmajit Das <brahmajit.xyz@gmail.com>2024-12-29 13:53:46 +0530
committerBrahmajit Das <brahmajit.xyz@gmail.com>2024-12-29 13:53:46 +0530
commit5b62a6fdcaf0604d1234a89d0629680ca77317a5 (patch)
tree8c767ded3caf88aeac872ddd3f593e00abe91a2d
parent3150e42b2b3c2e9ea7da1d8ea0d06243d0d56d2a (diff)
moving clipboard setting to separate file in plugin folder
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
-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