From 708e0c38fdcfd84a0028c4b261d77c4b2f5083df Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 1 Nov 2026 09:55:22 +0800 Subject: core: one vimrc and tmux.conf for Mac and Linux --- core/tmux.conf | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'core/tmux.conf') diff --git a/core/tmux.conf b/core/tmux.conf index 465641c..97084f1 100644 --- a/core/tmux.conf +++ b/core/tmux.conf @@ -1,15 +1,41 @@ -# True-color support regardless of what TERM the outer terminal/distro sets -set -g default-terminal "tmux-256color" -set -ga terminal-overrides ",*256col*:Tc" - +# Ctrl-b f: prompt for text, list windows whose name, pane title or pane contents match; Enter jumps +# Ctrl-b w: tree of every window in every session; press f inside it to filter by name, Enter jumps +# Ctrl-b s: tree of sessions (same tree, session view) +# Ctrl-b p: go to the previous window (lower index, wraps); Ctrl-b n goes to the next one +# # Vi mode for copy setw -g mode-keys vi # Mouse selection set -g mouse on +# Persistent pane index labels (top-left of each pane's border) +set -g pane-border-status top +set -g pane-border-format "#P" + +# Explicitly swap current pane with a pane index you type in +bind-key P command-prompt -p "swap with pane #:" "swap-pane -d -t '%%'" +# Manual: :swap-pane -s -t + +# Vim-style pane resizing (prefix + H/J/K/L), magnitude 1 +bind -r H resize-pane -L 1 +bind -r J resize-pane -D 1 +bind -r K resize-pane -U 1 +bind -r L resize-pane -R 1 + # v to start selection, y to yank (like vim) bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi y send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" -bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1" +# macOS: pbcopy. Linux: wl-copy/xclip when usable, else just drain (tmux's own +# buffer + set-clipboard/OSC 52 still apply). Netcat send is the same on both. +if-shell 'uname | grep -q Darwin' { + 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'" + 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'" + 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'" +} { + # Linux only: true-color regardless of what TERM the outer terminal/distro sets + set -g default-terminal "tmux-256color" + set -ga terminal-overrides ",*256col*:Tc" + 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'" + 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'" + 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'" +} -- cgit