This commit is contained in:
2026-04-01 14:21:37 +02:00
parent 610d51b918
commit def21c8d43

View File

@@ -1,8 +1,24 @@
# ══════════════════════════════════════════════════════════════════════════════
# NORD THEMED TMUX CONFIG
# ══════════════════════════════════════════════════════════════════════════════
# ─────────────────────────────────────────────────────────────────────────────
# Nord Color Palette (Reference)
# ─────────────────────────────────────────────────────────────────────────────
# Polar Night: #2E3440 #3B4252 #434C5E #4C566A
# Snow Storm: #D8DEE9 #E5E9F0 #ECEFF4
# Frost: #8FBCBB #88C0D0 #81A1C1 #5E81AC
# Aurora: #BF616A #D08770 #EBCB8B #A3BE8C #B48EAD
# ─────────────────────────────────────────────────────────────────────────────
# General Settings
# ─────────────────────────────────────────────────────────────────────────────
# Similar to screen (C-a C-a) # Similar to screen (C-a C-a)
bind-key C-b last-window bind-key C-b last-window
# Use colors the same way as screen does # True color support
set -g default-terminal "screen-256color" set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
# Don't wait for escape sequences # Don't wait for escape sequences
set -s escape-time 0 set -s escape-time 0
@@ -10,10 +26,22 @@ set -s escape-time 0
# Enable mouse scrolling # Enable mouse scrolling
set -g mouse on set -g mouse on
# Use vi style bindings # Use vi style bindings
set-window-option -g mode-keys vi set-window-option -g mode-keys vi
# Increase history limit
set -g history-limit 50000
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when one is closed
set -g renumber-windows on
# ─────────────────────────────────────────────────────────────────────────────
# Key Bindings
# ─────────────────────────────────────────────────────────────────────────────
# Move around panes with ALT + arrow keys. # Move around panes with ALT + arrow keys.
bind-key -n M-Up select-pane -U bind-key -n M-Up select-pane -U
bind-key -n M-Left select-pane -L bind-key -n M-Left select-pane -L
@@ -32,12 +60,242 @@ bind-key M-Left resize-pane -L 10
bind-key M-Down resize-pane -D 10 bind-key M-Down resize-pane -D 10
bind-key M-Right resize-pane -R 10 bind-key M-Right resize-pane -R 10
# Reload config
bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded!"
# ─────────────────────────────────────────────────────────────────────────────
# Window Settings
# ─────────────────────────────────────────────────────────────────────────────
# Automatically set window title # Automatically set window title
set-window-option -g automatic-rename on set-window-option -g automatic-rename on
set-option -g set-titles on set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
set-option -g status-left-length 40 # ─────────────────────────────────────────────────────────────────────────────
set-option -g status-left "#{pane_current_path} |" # Nord Theme - Pane Borders
set-option -g status-style fg=brightyellow,bg=black # ─────────────────────────────────────────────────────────────────────────────
set-option -g status-right "#(id -nu)@#h | %Y-%m-%d | %H:%M" set -g pane-border-style "fg=#4C566A"
set -g pane-active-border-style "fg=#88C0D0"
# ─────────────────────────────────────────────────────────────────────────────
# Nord Theme - Message Style
# ─────────────────────────────────────────────────────────────────────────────
set -g message-style "fg=#2E3440,bg=#EBCB8B,bold"
set -g message-command-style "fg=#2E3440,bg=#EBCB8B"
# ─────────────────────────────────────────────────────────────────────────────
# Nord Theme - Mode Style (copy mode, etc)
# ─────────────────────────────────────────────────────────────────────────────
set -g mode-style "fg=#2E3440,bg=#81A1C1"
# ─────────────────────────────────────────────────────────────────────────────
# Nord Theme - Status Bar
# ─────────────────────────────────────────────────────────────────────────────
set -g status on
set -g status-interval 2
set -g status-justify left
set -g status-position bottom
# Status bar colors
set -g status-style "fg=#D8DEE9,bg=#3B4252"
# Left status: Session name with icon (with prefix indicator)
set -g status-left-length 60
set -g status-left "#{?client_prefix,#[fg=#2E3440 bg=#EBCB8B bold] PREFIX #[fg=#EBCB8B bg=#3B4252 nobold],#[fg=#2E3440 bg=#81A1C1 bold] #S #[fg=#81A1C1 bg=#3B4252 nobold]}"
# Right status: Git, PWD, User, Time
set -g status-right-length 150
set -g status-right "\
#[fg=#4C566A,bg=#3B4252]#[fg=#D8DEE9,bg=#4C566A] #{b:pane_current_path} \
#[fg=#5E81AC,bg=#4C566A]#[fg=#ECEFF4,bg=#5E81AC] #(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD 2>/dev/null || echo '○') \
#[fg=#81A1C1,bg=#5E81AC]#[fg=#2E3440,bg=#81A1C1] 󰀄 #(whoami) \
#[fg=#88C0D0,bg=#81A1C1]#[fg=#2E3440,bg=#88C0D0] %H:%M \
#[fg=#8FBCBB,bg=#88C0D0]#[fg=#2E3440,bg=#8FBCBB,bold] %b %d "
# ─────────────────────────────────────────────────────────────────────────────
# Nord Theme - Window Status
# ─────────────────────────────────────────────────────────────────────────────
# Window separator
set -g window-status-separator ""
# Inactive windows
set -g window-status-format "#[fg=#3B4252,bg=#434C5E]#[fg=#D8DEE9,bg=#434C5E] #I #[fg=#D8DEE9,bg=#434C5E] #W #[fg=#434C5E,bg=#3B4252]"
# Active window (with zoom indicator)
set -g window-status-current-format "#{?window_zoomed_flag,#[fg=#3B4252 bg=#EBCB8B]#[fg=#2E3440 bg=#EBCB8B bold] #I #W #[fg=#EBCB8B bg=#3B4252 nobold],#[fg=#3B4252 bg=#88C0D0]#[fg=#2E3440 bg=#88C0D0 bold] #I #W #[fg=#88C0D0 bg=#3B4252 nobold]}"
# Activity indicator
set -g window-status-activity-style "fg=#EBCB8B,bg=#3B4252"
set -g window-status-bell-style "fg=#BF616A,bg=#3B4252,bold"
# ─────────────────────────────────────────────────────────────────────────────
# Nord Theme - Clock Mode
# ─────────────────────────────────────────────────────────────────────────────
set -g clock-mode-colour "#88C0D0"
set -g clock-mode-style 24
# ─────────────────────────────────────────────────────────────────────────────
# Copy Mode & System Clipboard Integration
# ─────────────────────────────────────────────────────────────────────────────
# Vi-style selection
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi Escape send-keys -X cancel
# Copy to system clipboard (supports X11 and Wayland)
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard 2>/dev/null || wl-copy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard 2>/dev/null || wl-copy"
# Mouse selection copies to clipboard automatically
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard 2>/dev/null || wl-copy"
# Double/triple click selection
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard 2>/dev/null || wl-copy"
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard 2>/dev/null || wl-copy"
# Paste from system clipboard
bind-key p run-shell "xclip -out -selection clipboard 2>/dev/null || wl-paste -n" \; paste-buffer
bind-key P run-shell "tmux set-buffer -- \"$(xclip -out -selection clipboard 2>/dev/null || wl-paste -n)\"; tmux paste-buffer"
# Quick copy last command output
bind-key C-c run-shell "tmux capture-pane -p -S -10 | head -n -1 | tail -n +2 | xclip -in -selection clipboard 2>/dev/null || wl-copy"
# ─────────────────────────────────────────────────────────────────────────────
# Display Pane Numbers
# ─────────────────────────────────────────────────────────────────────────────
set -g display-panes-colour "#4C566A"
set -g display-panes-active-colour "#88C0D0"
# ─────────────────────────────────────────────────────────────────────────────
# Focus Events (for vim integration)
# ─────────────────────────────────────────────────────────────────────────────
set -g focus-events on
# ─────────────────────────────────────────────────────────────────────────────
# Session Management
# ─────────────────────────────────────────────────────────────────────────────
# Quick session switcher (popup tree view)
bind-key s choose-tree -Zs
bind-key w choose-tree -Zw
# Create new session
bind-key N new-session
# Kill session
bind-key X confirm-before -p "Kill session #S? (y/n)" kill-session
# ─────────────────────────────────────────────────────────────────────────────
# Pane Management
# ─────────────────────────────────────────────────────────────────────────────
# Toggle synchronize panes (type in all panes at once)
bind-key S setw synchronize-panes \; display-message "Sync: #{?synchronize-panes,ON,OFF}"
# Swap panes
bind-key > swap-pane -D
bind-key < swap-pane -U
# Join pane from another window (bring it here)
bind-key J choose-window "join-pane -h -s '%%'"
# Break pane to new window
bind-key B break-pane -d
# Mark and swap - mark a pane with 'm', then go to another and swap with 'M'
bind-key m select-pane -m
bind-key M select-pane -m \; swap-pane
# Rotate panes
bind-key C-o rotate-window
# ─────────────────────────────────────────────────────────────────────────────
# Quick Navigation
# ─────────────────────────────────────────────────────────────────────────────
# Switch windows with Shift+Arrow without prefix
bind-key -n S-Left previous-window
bind-key -n S-Right next-window
# Switch to last window
bind-key Tab last-window
# Switch to last session
bind-key BTab switch-client -l
# Quick window selection (Alt+number)
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# ─────────────────────────────────────────────────────────────────────────────
# Popup Windows (tmux 3.2+)
# ─────────────────────────────────────────────────────────────────────────────
# Quick popup terminal (press again to close)
bind-key ` if-shell -F '#{==:#{session_name},popup}' { detach-client } { popup -d '#{pane_current_path}' -xC -yC -w80% -h80% -E 'tmux attach -t popup || tmux new -s popup' }
# Popup lazygit (if installed)
bind-key g popup -d '#{pane_current_path}' -xC -yC -w90% -h90% -E 'lazygit || git status'
# Popup htop
bind-key H popup -xC -yC -w80% -h80% -E 'htop || top'
# ─────────────────────────────────────────────────────────────────────────────
# Scratchpad / Notes
# ─────────────────────────────────────────────────────────────────────────────
# Quick scratchpad popup for notes
bind-key n popup -d '#{pane_current_path}' -xC -yC -w60% -h60% -E '$EDITOR ~/.tmux-notes.md || vim ~/.tmux-notes.md || nano ~/.tmux-notes.md'
# ─────────────────────────────────────────────────────────────────────────────
# Command Cheatsheet
# ─────────────────────────────────────────────────────────────────────────────
# Show keybinding help
bind-key ? display-popup -w80% -h80% -E "tmux list-keys | grep -v 'copy-mode' | less"
# ─────────────────────────────────────────────────────────────────────────────
# URL & File Handling (tmux 3.2+)
# ─────────────────────────────────────────────────────────────────────────────
# Open URLs from the terminal (requires urlview or fzf)
bind-key u capture-pane -J \; save-buffer /tmp/tmux-buffer \; delete-buffer \; split-window -l 10 "cat /tmp/tmux-buffer | grep -oE '(https?|ftp)://[^[:space:]]+' | sort -u | fzf --reverse | xargs -r xdg-open 2>/dev/null"
# ─────────────────────────────────────────────────────────────────────────────
# Visual Bell (less annoying)
# ─────────────────────────────────────────────────────────────────────────────
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity on
set -g bell-action none
# ─────────────────────────────────────────────────────────────────────────────
# Quick Actions
# ─────────────────────────────────────────────────────────────────────────────
# Clear screen and history
bind-key C-l send-keys C-l \; clear-history
# Toggle status bar
bind-key t set-option status
# Edit config
bind-key e new-window -n 'tmux.conf' '$EDITOR ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display "Config reloaded!"'
# ─────────────────────────────────────────────────────────────────────────────
# Layout Presets
# ─────────────────────────────────────────────────────────────────────────────
# Quick layouts
bind-key M-1 select-layout even-horizontal
bind-key M-2 select-layout even-vertical
bind-key M-3 select-layout main-horizontal
bind-key M-4 select-layout main-vertical
bind-key M-5 select-layout tiled
# ─────────────────────────────────────────────────────────────────────────────
# Enhanced Mouse Support
# ─────────────────────────────────────────────────────────────────────────────
# Double click to select word, triple click to select line
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line