Skip to content

Instantly share code, notes, and snippets.

@dstanek
Created March 19, 2026 14:53
Show Gist options
  • Select an option

  • Save dstanek/62f95de26de415f180a1408d4e80c485 to your computer and use it in GitHub Desktop.

Select an option

Save dstanek/62f95de26de415f180a1408d4e80c485 to your computer and use it in GitHub Desktop.
#
# tmux configuration file
#
# Use a better prefix
unbind C-b ; set -g prefix C-space
unbind C-s ; set -g prefix2 C-s
bind C-space last-window
set -g history-limit 16384
set -g default-shell /bin/zsh
set -g default-terminal "tmux-256color"
set -as terminal-features ",$TERM:RGB"
set -g set-titles on
set -g set-titles-string '#h: [#S:#W] #T'
# index windows starting with 1 instead of 0
set -g base-index 1
# don't rename windows automatically
set -g allow-rename off
# notifications
setw -g monitor-activity on
# only constrain the view to the smallest *active* client
setw -g aggressive-resize on
set -g mouse on
# Key bindings {{{
bind R source-file ~/.config/tmux/tmux.conf \; display-message "Configuration reloaded ✔"
bind / command-prompt -p "man:" "split-window -v 'man %%'"
bind S command-prompt -p "ssh:" "new-window -n %1 'magic-ssh %%'"
bind H split-window -v "man tmux"
bind I new-window -n "irc" "weechat"
bind M new-window -n "email" "mutt"
bind C-s choose-tree -s
# Vim-like bindings {{{
# New stuff: https://github.com/tmux/tmux/commit/76d6d3641f271be1756e41494960d96714e7ee58
# use "v" and "s" to do vertical/horizontal splits, like vim
unbind '"' ; bind s split-window -v
unbind % ; bind v split-window -h
# use the vim motion keys to move between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# use vim motion keys while in copy mode
setw -g mode-keys vi
unbind [ ; bind Escape copy-mode
set -s escape-time 150
bind -T copy-mode-vi Space send -X cursor-right
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi Enter send -X cursor-down
bind -T copy-mode-vi V send -X select-line
bind -T copy-mode-vi C-v send -X rectangle-toggle \; send -X begin-selection
#
# Windows clipboard integration
#
# If MacOS is available
if-shell 'command -v pbpaste >/dev/null 2>&1' \
'set -g @sys_paste "pbpaste"'
# If Xorg is available
if-shell 'command -v xclip >/dev/null 2>&1' \
'set -g @sys_paste "xclip -selection clipboard -o"'
# If Wayland is available (overrides Xorg settings if both are available)
if-shell 'command -v wl-paste >/dev/null 2>&1' \
'set -g @sys_paste "wl-paste --no-newline"'
bind C-p display -p 'sys_paste = "#{@sys_paste}"'
# bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection clipboard -in"
# bind ] run "xclip -o -sel clip | tmux load-buffer - ; tmux paste-buffer"
bind -T copy-mode-vi y send -X copy-pipe-and-cancel
bind ] run-shell '#{@sys_paste} | tmux load-buffer - && tmux paste-buffer'
# use the vim resize keys
bind < resize-pane -L 3
bind > resize-pane -R 3
bind - resize-pane -D 3
bind + resize-pane -U 3
# }}}
# }}}
# bell support {{{
# ring terminal bell in the current window when
# none: never
# any: when any window bell occurs
# current: only when a bell occurs in the current window
set -g bell-action any
set -g visual-bell off
# }}}
# urlview support {{{
bind u capture-pane \; save-buffer ~/.tmp/tmux-buffer \; new-window '$SHELL -c "urlview < ~/.tmp/tmux-buffer"'
# }}}
# Style {{{
# Nord colors
gray_light="#D8DEE9"
gray_medium="#ABB2BF"
gray_dark="#3B4252"
green_soft="#A3BE8C"
blue_muted="#81A1C1"
cyan_soft="#88C0D0"
set -g status-position top
# Length of tmux status line
set -g status-left-length 30
set -g status-right-length 150
# Faster status updates (for the cwd!)
set -g status-interval 1
set -g status-style "fg=${gray_light},bg=${gray_dark}"
set -g status-left "#[fg=${green_soft}]  #S"
set -g status-right "#(~/.config/tmux/scripts/cwd.sh) 󱄄 #h #[fg=${cyan_soft}]#{?scroll_position,^#{scroll_position},}"
set -g status-justify absolute-centre # Center the window list in the status line
set -g window-status-current-format "#[fg=${cyan_soft},bold] 󰫢 #[underscore]#I:#W"
set -g window-status-format " #I:#W"
set -g message-style "fg=${gray_light},bg=default"
set -g mode-style "fg=${gray_dark},bg=${blue_muted}"
set -g pane-border-style "fg=${gray_dark}"
set -g pane-active-border-style "fg=${gray_medium}"
# }}}
if-shell 'test -f "$HOME/.tmux.conf.local"' 'source ~/.tmux.conf.local'
# vim:fdm=marker:ft=tmux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment