Skip to content

Instantly share code, notes, and snippets.

@bitmorse
Last active January 18, 2025 12:01
Show Gist options
  • Save bitmorse/a74bcc5a2ec06e3e21c5072a6d516795 to your computer and use it in GitHub Desktop.
Save bitmorse/a74bcc5a2ec06e3e21c5072a6d516795 to your computer and use it in GitHub Desktop.
Awesome .tmux.conf by MacLemon for DACH keyboards layouts, modified
##############################################################################
# tmux(1) configuration file. ┌─┬─┐ #
# Made for tmux 2.7 or highter │ ├─┤ #
# MacLemon, https://maclemon.at/ └─┴─┘ #
##############################################################################
# Command keys are case-sensitive.
# Prefix Key
# Default: C-b
# C-b is inconvenient to reach on the keyboard and also vim uses it.
# This frees the key for other functions
unbind-key C-b
# C-y is very convenient to reach on a german keyboard, YMMV.
# I don't like to use C-a because it's a readline binding to go to the
# beginning of the line.
set-option -g prefix C-y
# secondary Prefix key
set-option -g prefix2 C-x
# To quickly toggle between the last two windows, set the last-window command
# to the same key as the $PREFIX.
bind-key C-y last-window
# Allows us to use PREFIX <character> <command> to send commands to a tmux(1)
# session inside another tmux(1) session. (eg:Nesting a remote tmux(1)
# session over ssh(1) in your local tmux(1) session.
# I keep this the same character as PREFIX but without the control key.
bind-key y send-prefix
# Set the command sending delay to 0. Makes everything more responsive and
# longer delays may interfere with command line tools like vim(1).
set -sg escape-time 1
##############################################################################
# Status line
##############################################################################
# Position of the status line
set-option -g status-position bottom # top | bottom
# Update the status line every n-seconds.
set -g status-interval 30
# Keep the window list left-aligned
set -g status-justify left
# Set status bar (can only be a single line high)
# Set status bar background color,foreground color
set -g window-status-style "bg=blue,fg=white"
# Set maximum length of the left status area (in characters)
set-option -g status-left-length 50
# Set maximum length of the right status area (in characters)
set-option -g status-right-length 60
# Left status bar contents and functionality:
set -g status-left "#{?client_prefix,#[reverse]#[fg=brightyellow]#S#[noreverse],#[fg=brightyellow]#S}#[fg=brightwhite]#[fg=default]│"
# Right status bar contents and functionality:
set -g status-right " #[fg=brightgreen]#H#[fg=white]│%H:%M %Y-%m-%d#{?client_utf8, 👻 }"
# Highlight active window
set-window-option -g window-status-current-style "bg=brightgreen,fg=black,bright"
# Very subtle hint which was your last active window for easy switching
set-window-option -g window-status-last-style "fg=brightyellow,bold"
# Character that separates windows from each other in the status bar.
set-window-option -g window-status-separator │
# Lengthen the amount of time status messages are displayed
set-option -g display-time 2000
set-option -g display-panes-time 3000
########################################
# Window handling and Session nesting. #
########################################
# Start numbering windows and panes at index 1
set -g base-index 1
# For consistency, pane indexing begins at 1 as well.
set-window-option -g pane-base-index 1
# Make 0 access window 10
unbind 0
bind-key 0 select-window -t :10
# Window activity monitor
setw -g monitor-activity on
set -g visual-activity on
# Clock settings
set-window-option -g clock-mode-colour yellow
set-window-option -g clock-mode-style 24
# Prevents tmux from auto-renaming windows
set-option -g allow-rename off
###############################################################
# Panes
###############################################################
# Split windows into panes
unbind '"'
unbind %
bind-key h split-window -v # Split horizontally
bind-key s split-window -h # Split vertically
bind-key a choose-tree -s
# Pane navigation (with arrow keys and vim-like keys)
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
# Resize panes (with vim-like keys and arrow keys)
bind-key -r H resize-pane -L
bind-key -r J resize-pane -D
bind-key -r K resize-pane -U
bind-key -r L resize-pane -R
bind-key -n M-Up resize-pane -U
bind-key -n M-Down resize-pane -D
bind-key -n M-Left resize-pane -L
bind-key -n M-Right resize-pane -R
# Close pane
bind-key x kill-pane
#####################################################
# Copy Mode and Search
bind-key c copy-mode # Enter copy mode
bind-key -T copy-mode-vi f send-key / # Forward search with Ctrl-y f
bind-key -T copy-mode-vi n send-key n # Next search result
bind-key -T copy-mode-vi p send-key N # Previous search result
#####################################################
# Scrollback
set-option -g history-limit 20000
# Split Highlighting
set-option -g pane-border-style "fg=brightblack"
set-option -g pane-active-border-style "fg=blue"
#####################################################
# Mouse support
set -g mouse on
#" Sane scrolling:
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e; send-keys -M'"
#####################################################
# Other Useful Key Bindings
bind-key Tab last-window # Toggle between last two windows
bind-key R source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded."
bind-key w command-prompt "rename-window %%"
bind-key d detach # Detach from session
bind-key k kill-session # Kill session
#####################################################
# Terminal, Colors, and Key Options
set-window-option -g xterm-keys on
set-option -g status-keys vi
set -g default-terminal "xterm-256color"
###########################################################
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment