Copy the text in remote Vim to local clipboard. It depends on OSC52 escape sequences. Unlike other OSC52 Vim scripts (e.g. code snippet in chromium hterm), it solves the flash problem when copy the text.
- Vim 7.3 or higher, Neovim.
- Python3+.
- Terminal that supported OSC52 escape sequences.
- Tmux 3.3 and above: Add
set -g allow-passthrough onin tmux config.
You can install this plugin via Vim plugin managers. Then add following code in your vimrc.
vmap <C-c> y:call remote_copy#copy2clipboard(getreg('"'))<cr>Plugin 'Hanaasagi/remote-copy.vim'git clone --depth=1 https://github.com/Hanaasagi/remote-copy.vim ~/.vim/bundle/remote-copy.vimPlug 'Hanaasagi/remote-copy.vim'{
"Hanaasagi/remote-copy.vim",
config = function()
vim.keymap.set("v", "<C-c>",
[[y:call remote_copy#copy2clipboard(getreg('"'))<CR>]],
{ silent = true , noremap=true, desc="copy text"})
end,
},
BSD 3-Clause License
Copyright (c) 2021, 秋葉 All rights reserved.