OSC52 clipboard yanks

This commit is contained in:
Christian Nieves
2023-02-13 12:31:47 -06:00
parent 189570685b
commit 84aa6e8933
7 changed files with 117 additions and 47 deletions

View File

@ -4,7 +4,7 @@ set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CO
set -g prefix C-a
bind C-a send-prefix
set -g mouse on
set -g mouse off
set -g prefix `
bind-key ` send-prefix
@ -26,8 +26,17 @@ set -g pane-base-index 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color*:Tc" # tell Tmux that outside terminal supports true color
# enable OSC 52 clipboard
set -s set-clipboard external
# tmux-256color instead of screen-256color enables italics
set -g default-terminal "tmux-256color"
# Tc enables true color
set -ag terminal-overrides ",*256col*:colors=256:Tc"
set -as terminal-features ',rxvt-unicode-256color:clipboard'
set -g allow-passthrough on
# set -g default-shell zsh
# force a reload of the config file
@ -54,7 +63,18 @@ setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -sel clip -i"
# transfer copied text to attached terminal with yank
bind-key -T copy-mode-vi y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer copied text to attached terminal with yank
bind-key -T copy-mode-vi Y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer most-recently copied text to attached terminal with yank
bind-key -n M-y run-shell 'tmux save-buffer - | yank > #{pane_tty}'
# transfer previously copied text (chosen from a menu) to attached terminal
bind-key -n M-Y choose-buffer 'run-shell "tmux save-buffer -b \"%%%\" - | yank > #{pane_tty}"'
# Bind ']' to use pbpaste
#bind ] run "pbpaste | tmux load-buffer - && tmux paste-buffer"