tmux: continue tweaking

This commit is contained in:
Paul Walker
2025-04-28 12:57:11 +01:00
parent 143f105a08
commit 14f5a0a0c2
2 changed files with 19 additions and 11 deletions

View File

@@ -1,14 +1,14 @@
# Detect the display server protocol and set clipboard commands
if-shell '[ "$XDG_SESSION_TYPE" = "wayland" ]' \
'set -g copy-command "wl-copy"; set -g paste-command "wl-paste -n"' \
'set -g copy-command "xclip -sel clip -i"; set -g paste-command "xclip -sel clip -o"'
# if-shell '[ "$XDG_SESSION_TYPE" = "wayland" ]' \
# 'set -g copy-command "wl-copy"; set -g paste-command "wl-paste -n"' \
# 'set -g copy-command "xclip -sel clip -i"; set -g paste-command "xclip -sel clip -o"'
# Take the buffer and send it to the system clipboard
bind C-c run "tmux save-buffer - | $copy_command"
bind C-c run 'tmux save-buffer - | pbcopy_l'
# y in copy mode takes selection and sends it to system clipboard
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$copy_command"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy_l"
# And the reverse - Prefix Ctrl-v fills tmux buffer from system clipboard, then
# pastes from buffer into tmux window
bind C-v run-shell '$paste_command | tmux load-buffer - \; paste-buffer'
bind C-v run-shell 'pbpaste_l | tmux load-buffer - \; paste-buffer'