tmux: Updated config
This commit is contained in:
@@ -12,14 +12,14 @@ set -g base-index 1
|
|||||||
setw -g pane-base-index 1
|
setw -g pane-base-index 1
|
||||||
|
|
||||||
# Increase the history limit (useful for longer command histories)
|
# Increase the history limit (useful for longer command histories)
|
||||||
set-option -g history-limit 10000
|
set-option -g history-limit 50000
|
||||||
|
|
||||||
### Startup Configuration
|
### Startup Configuration
|
||||||
# Start a new session named "main" if none exists
|
# Attach to session "main" or create it if it doesn't exist
|
||||||
new-session -s main
|
new-session -A -s main
|
||||||
|
|
||||||
# Start htop and split the window when the session "main" is created
|
# Start htop and split the window when the session "main" is created
|
||||||
set-hook -t main session-created 'send-keys -t main:1 "sudo htop" C-m; split-window'
|
set-hook -t main after-new-session 'send-keys -t main:1 "htop" C-m; split-window'
|
||||||
|
|
||||||
### Key Bindings
|
### Key Bindings
|
||||||
# Remap the prefix key from 'C-b' (Ctrl-b) to 'C-a' (Ctrl-a)
|
# Remap the prefix key from 'C-b' (Ctrl-b) to 'C-a' (Ctrl-a)
|
||||||
@@ -28,27 +28,27 @@ set-option -g prefix C-a
|
|||||||
bind-key C-a send-prefix
|
bind-key C-a send-prefix
|
||||||
|
|
||||||
# Split panes using 'h' for horizontal and 'v' for vertical splits
|
# Split panes using 'h' for horizontal and 'v' for vertical splits
|
||||||
bind "h" split-window -h
|
bind h split-window -h
|
||||||
bind "v" split-window -v
|
bind v split-window -v
|
||||||
unbind '"'
|
unbind '"'
|
||||||
unbind %
|
unbind %
|
||||||
|
|
||||||
# Reload the tmux configuration file with 'r'
|
# Reload the tmux configuration file with 'r'
|
||||||
bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf
|
bind r source-file ~/.config/tmux/tmux.conf
|
||||||
|
|
||||||
### Clipboard Integration
|
### Clipboard Integration
|
||||||
# Enable clipboard
|
# Enable clipboard via OSC 52 (works locally and over SSH/mosh)
|
||||||
set -s set-clipboard on
|
set -s set-clipboard on
|
||||||
set -ag terminal-overrides ",*:Ms=\\E]52;c;%p2%s\\7"
|
set -ag terminal-overrides ',*:Ms=\E]52;c;%p2%s\7'
|
||||||
|
|
||||||
# Vi-style copy mode
|
# Vi-style copy mode
|
||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
|
|
||||||
# Copy mode key bindings
|
# Copy mode key bindings
|
||||||
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
||||||
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
|
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel ~/.config/tmux/yank.sh
|
||||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
|
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel ~/.config/tmux/yank.sh
|
||||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
|
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel ~/.config/tmux/yank.sh
|
||||||
|
|
||||||
### Status and Window Configuration
|
### Status and Window Configuration
|
||||||
# Set the status bar update interval to 1 second
|
# Set the status bar update interval to 1 second
|
||||||
@@ -102,8 +102,8 @@ setw -g window-status-current-format '#[bg=#c6a0f6,fg=black] #I #[bg=#585B70,fg=
|
|||||||
# Set the separator between window statuses
|
# Set the separator between window statuses
|
||||||
set -g window-status-separator " "
|
set -g window-status-separator " "
|
||||||
|
|
||||||
# Status bar right settings (display host information)
|
# Status bar right settings (display host information, red when connected via SSH)
|
||||||
set -g status-right "#[fg=black,bg=#7dc4e4] H #[fg=white,bg=brightblack] #H "
|
set -g status-right '#{?SSH_CONNECTION,#[fg=black bg=#ed8796],#[fg=black bg=#7dc4e4]} H #[fg=white,bg=brightblack] #H '
|
||||||
|
|
||||||
# Set the maximum length for the right status
|
# Set the maximum length for the right status
|
||||||
set -g status-right-length 40
|
set -g status-right-length 40
|
||||||
|
|||||||
@@ -7,11 +7,10 @@ set -eu
|
|||||||
buf=$(cat)
|
buf=$(cat)
|
||||||
|
|
||||||
# Try methods in order of preference
|
# Try methods in order of preference
|
||||||
copy_backend_remote_tunnel_port=$(tmux show-option -gvq "@copy_backend_remote_tunnel_port" 2>/dev/null || echo "")
|
|
||||||
|
|
||||||
# Method 1: Use pbcopy if available (local macOS)
|
# Method 1: Use pbcopy if available (local macOS)
|
||||||
if command -v pbcopy >/dev/null 2>&1; then
|
if command -v pbcopy >/dev/null 2>&1; then
|
||||||
printf "%s" "$buf" | pbcopy
|
printf '%s' "$buf" | pbcopy
|
||||||
# Method 2: OSC 52 (for mosh/ssh)
|
# Method 2: OSC 52 (for mosh/ssh)
|
||||||
elif [ -n "${TMUX:-}" ]; then
|
elif [ -n "${TMUX:-}" ]; then
|
||||||
# Get the tmux tty
|
# Get the tmux tty
|
||||||
|
|||||||
Reference in New Issue
Block a user