From 5af53df5cebeb7f817e948f7ad8447a45ab3425f Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Mon, 10 Jul 2023 09:09:26 +0200 Subject: [PATCH] copy --- bashrc | 1 - init.lua | 20 ++++++++++++++++++++ tmux.conf | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 9a54db4..0bb6d28 100644 --- a/bashrc +++ b/bashrc @@ -25,4 +25,3 @@ eval "$(~/.rbenv/bin/rbenv init - bash)" alias vim=nvim export EDITOR=nvim export TERM='xterm-256color' - diff --git a/init.lua b/init.lua index 3695622..ffe2f84 100644 --- a/init.lua +++ b/init.lua @@ -70,6 +70,7 @@ require("lazy").setup({ opts = {}, }, "nvim-lualine/lualine.nvim", + "ojroques/nvim-osc52", }) require("fidget").setup({}) @@ -261,3 +262,22 @@ require("scrollbar").setup() -- Status line require("lualine").setup() + +-- OSC52 copy +local function copy(lines, _) + require("osc52").copy(table.concat(lines, "\n")) +end + +local function paste() + return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") } +end + +vim.g.clipboard = { + name = "osc52", + copy = { ["+"] = copy, ["*"] = copy }, + paste = { ["+"] = paste, ["*"] = paste }, +} + +-- Now the '+' register will copy to system clipboard using OSC52 +vim.keymap.set("n", "c", '"+y') +vim.keymap.set("n", "cc", '"+yy') diff --git a/tmux.conf b/tmux.conf index 279336d..5d89e43 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,5 +1,7 @@ set -g mouse on +set -g set-clipboard on + # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible'