diff --git a/home/vim/default.nix b/home/vim/default.nix index a97472e..abd185e 100644 --- a/home/vim/default.nix +++ b/home/vim/default.nix @@ -60,6 +60,7 @@ in # General enhancements vim-qf # Better quick-fix list + nvim-osc52 # Send clipboard data through terminal escape for SSH # Other wrappers git-messenger-vim # A simple blame window diff --git a/home/vim/plugin/settings/ssh.lua b/home/vim/plugin/settings/ssh.lua new file mode 100644 index 0000000..3af7b61 --- /dev/null +++ b/home/vim/plugin/settings/ssh.lua @@ -0,0 +1,17 @@ +if not require("ambroisie.utils").is_ssh() then + return +end + +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}, +}