summaryrefslogtreecommitdiff
path: root/core/tmux.conf
diff options
context:
space:
mode:
authorxs <xs@xs.local>2026-11-05 10:45:29 +0800
committerxs <xs@xs.local>2026-11-05 10:45:32 +0800
commitbbe55a3f647f07a6b7c9852a499c45d03ac068af (patch)
treec35e6da0cb789718ad026e8ef2be28a4fb77102d /core/tmux.conf
parentdc1ff54f7290a42ae440389141401b78ed76d473 (diff)
core: shared clipboard over ssh to root@p.noml.ch
tmux.conf and vimrc push yanks to /dev/shm/clip/buf on CLIP_HOST (root@p.noml.ch) and pull before every paste (tmux prefix+], every vim p variant, 3 s limit, local paste when no buffer exists yet). One persistent ssh link per machine (ControlPersist=yes, ControlPath ~/.ssh/cm-%C), host key not checked. Replaces the openssl+netcat sender. vimrc: set nocompatible so /etc/vimrc parses \ continuations and <leader>.
Diffstat (limited to 'core/tmux.conf')
-rw-r--r--core/tmux.conf29
1 files changed, 17 insertions, 12 deletions
diff --git a/core/tmux.conf b/core/tmux.conf
index 97084f1..2a0e161 100644
--- a/core/tmux.conf
+++ b/core/tmux.conf
@@ -23,19 +23,24 @@ bind -r J resize-pane -D 1
23bind -r K resize-pane -U 1 23bind -r K resize-pane -U 1
24bind -r L resize-pane -R 1 24bind -r L resize-pane -R 1
25 25
26# v to start selection, y to yank (like vim) 26# ===== Shared clipboard: RAM file /dev/shm/clip/buf on CLIP_HOST =====
27%hidden CLIP_HOST="root@p.noml.ch"
28# One persistent ssh link (opens on first use, one key touch).
29# Close it: ssh -O exit -o ControlPath=~/.ssh/cm-%C <CLIP_HOST>
30%hidden CLIP="ssh -o ControlMaster=auto -o ControlPersist=yes -o ControlPath=~/.ssh/cm-%C -o ServerAliveInterval=30 -o ConnectTimeout=3 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR $CLIP_HOST"
31# push (yank): copy mode v to select, then y / Enter / mouse drag
32%hidden YANK="$CLIP 'umask 077; mkdir -p /dev/shm/clip && cat >/dev/shm/clip/new && mv /dev/shm/clip/new /dev/shm/clip/buf'"
27bind-key -T copy-mode-vi v send-keys -X begin-selection 33bind-key -T copy-mode-vi v send-keys -X begin-selection
28# macOS: pbcopy. Linux: wl-copy/xclip when usable, else just drain (tmux's own 34bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "$YANK"
29# buffer + set-clipboard/OSC 52 still apply). Netcat send is the same on both. 35bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "$YANK"
30if-shell 'uname | grep -q Darwin' { 36bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "$YANK"
31 bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" 37# pull (paste): prefix + ] fetches the buffer into tmux, then pastes it;
32 bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" 38# no buffer on CLIP_HOST yet (exit 3, e.g. after its reboot) = paste tmux's own buffer
33 bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(pbcopy) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'" 39bind-key ] run-shell "f=\$(mktemp); $CLIP '[ -f /dev/shm/clip/buf ] || exit 3; cat /dev/shm/clip/buf' >\$f; r=\$?; [ \$r -eq 0 ] && tmux load-buffer \$f; rm -f \$f; [ \$r -eq 0 ] || [ \$r -eq 3 ] && tmux paste-buffer"
34} { 40# ===== end shared clipboard =====
35 # Linux only: true-color regardless of what TERM the outer terminal/distro sets 41
42# Linux only: true-color regardless of what TERM the outer terminal/distro sets
43if-shell 'uname | grep -q Darwin' {} {
36 set -g default-terminal "tmux-256color" 44 set -g default-terminal "tmux-256color"
37 set -ga terminal-overrides ",*256col*:Tc" 45 set -ga terminal-overrides ",*256col*:Tc"
38 bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'"
39 bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'"
40 bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "bash -c 'tee >(wl-copy 2>/dev/null || xclip -selection clipboard 2>/dev/null || cat >/dev/null) | openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1'"
41} 46}