[tmux] Fix clipboard

This commit is contained in:
Fabian Ising
2025-08-26 11:16:44 +02:00
parent 6fd62c340d
commit cda37c3415
2 changed files with 29 additions and 2 deletions

View File

@@ -244,7 +244,33 @@ nmap <Leader>t :call TextWrapToggle()<CR>
"Copying
if !exists('g:vscode')
lua << EOF
vim.g.clipboard = 'osc52'
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
if vim.env.TMUX ~= nil then
local copy = {'tmux', 'load-buffer', '-w', '-'}
local paste = {'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -'}
vim.g.clipboard = {
name = 'tmux',
copy = {
['+'] = copy,
['*'] = copy,
},
paste = {
['+'] = paste,
['*'] = paste,
},
cache_enabled = 0,
}
end
EOF
endif
set clipboard=unnamedplus,unnamed " Copy/Paste