[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 "Copying
if !exists('g:vscode') if !exists('g:vscode')
lua << EOF 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 EOF
endif endif
set clipboard=unnamedplus,unnamed " Copy/Paste set clipboard=unnamedplus,unnamed " Copy/Paste

View File

@@ -74,7 +74,8 @@ bind-key C-o send-keys C-o
# move tmux copy buffer into x clipboard # move tmux copy buffer into x clipboard
# Vi copypaste mode # Vi copypaste mode
set-window-option -g mode-keys vi set-window-option -g mode-keys vi
set-option -s set-clipboard on set -g allow-passthrough on
set-option -g set-clipboard on
set -g @yank_with_mouse off set -g @yank_with_mouse off
set -g @yank_action 'copy-pipe' set -g @yank_action 'copy-pipe'
bind-key -Tcopy-mode-vi 'C-right' send -X next-word bind-key -Tcopy-mode-vi 'C-right' send -X next-word