changeset 614:ad5e870cd4b2

replace osc52 plugin
author zegervdv <zegervdv@me.com>
date Mon, 25 Jul 2022 14:09:08 +0200
parents c79b392e7919
children 0cace1b99e77
files .chezmoitemplates/config.vim .chezmoitemplates/init.lua dot_tmux.conf
diffstat 3 files changed, 15 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/.chezmoitemplates/config.vim	Mon Jul 25 13:56:58 2022 +0200
+++ b/.chezmoitemplates/config.vim	Mon Jul 25 14:09:08 2022 +0200
@@ -315,25 +315,6 @@
 " Vinegar/NetRW
 autocmd FileType netrw setl bufhidden=delete
 "
-
-function! SendOSCClipboard(lines, regtype)
-   call SendViaOSC52(join(a:lines, "\n"))
-endfunction
-
-if !s:windows
-  let g:clipboard = {
-        \   'name': 'TMUX',
-        \   'copy': {
-        \      '+': function('SendOSCClipboard'),
-        \      '*': 'tmux load-buffer -',
-        \    },
-        \   'paste': {
-        \      '+': 'tmux save-buffer -',
-        \      '*': 'tmux save-buffer -',
-        \   },
-        \   'cache_enabled': 1,
-        \ }
-endif
 " Load local vimrc
 if filereadable($HOME . '/.vimrc.local')
   source ~/.vimrc.local
--- a/.chezmoitemplates/init.lua	Mon Jul 25 13:56:58 2022 +0200
+++ b/.chezmoitemplates/init.lua	Mon Jul 25 14:09:08 2022 +0200
@@ -26,7 +26,18 @@
   use { 'tpope/vim-repeat' }
   use { 'tpope/vim-rsi' }
   use { 'sgur/vim-editorconfig' }
-  use { 'ShikChen/osc52.vim' }
+  use {
+    'ojroques/nvim-osc52',
+    config = function()
+      local copy = function(lines, _) require('osc52').copy(table.concat(lines, '\n')) end
+      local paste = function() return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' } end
+      vim.g.clipboard = {
+        name = 'osc52',
+        copy = { ['+'] = copy, ['*'] = copy },
+        paste = { ['+'] = paste, ['*'] = paste },
+      }
+    end,
+  }
   use { 'einfachtoll/didyoumean' }
 
   use {
--- a/dot_tmux.conf	Mon Jul 25 13:56:58 2022 +0200
+++ b/dot_tmux.conf	Mon Jul 25 14:09:08 2022 +0200
@@ -106,6 +106,9 @@
 set-window-option -g visual-bell on
 set-window-option -g bell-action other
 
+# Allow OSC52 from applications
+set -s set-clipboard on
+
 # Local config
 if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'