Skip to content

Instantly share code, notes, and snippets.

@yogan
Created January 28, 2021 18:09
Show Gist options
  • Save yogan/da87977dc9d758256330aa6b1f990e1d to your computer and use it in GitHub Desktop.
Save yogan/da87977dc9d758256330aa6b1f990e1d to your computer and use it in GitHub Desktop.
tmux config
# Originally taken from:
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
# status bar default colors:
set-option -g status-style fg=colour136,bg=colour235
# default and active window titles in status bar:
set-option -g window-status-format '#[fg=colour136]#I#[fg=colour242] #W#F'
set-option -g window-status-current-format '#[fg=colour237,bg=colour235]#[fg=colour178,bg=colour237] #I#[fg=colour248] #W#F #[fg=colour237,bg=colour235]'
set-option -g window-status-bell-style fg=colour202,bold
set-option -g window-status-style fg=colour244
# message text (overlays status bar):
set-option -g message-style fg=colour68,bg=colour235
# selection bar in window/session choose tree (^A w / ^A S):
set-option -wg mode-style fg=colour235,bg=colour136
# pane borders:
set-option -g pane-border-style fg=colour235,bg=colour233
set-option -g pane-active-border-style fg=colour136,bg=colour233
# colors of pane numbers (^A q) and clock (^A t):
set-option -g display-panes-colour colour136 # orange
set-option -g display-panes-active-colour colour33 # blue
set-option -g clock-mode-colour colour33 # blue
# status bar
set -g status-interval 10 # update status bar every X seconds
set -g status-justify centre # center align window list
set -g status-left '#[fg=colour214,bg=colour239] #H #[fg=colour239,bg=colour237]#[fg=colour136,bg=colour237] #S #[fg=colour237,bg=colour235]'
set -g status-left-length 40 # should fit host & session name
set -g status-right '#[fg=colour237,bg=colour235]#[fg=colour136,bg=colour237] %a %Y-%m-%d #[fg=colour239,bg=colour237]#[fg=colour214,bg=colour239] %H:%M '
set -g status-right-length 25 # exactly matches format: " Sun 2013-10- 06 11:48"
# C-a just like screen. Old habits never die.
set-option -g prefix C-a
unbind-key C-b
# Allows us to use C-a a <command> to send commands to a tmux session inside
# another tmux session
bind-key a send-prefix
# Start numbering at 1
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on # renumber windows when a window is closed
# Allows for faster key repetition
set -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Activity monitoring
setw -g monitor-activity off
set -g visual-activity on
# Vi copypaste mode:
# 1) ^A [ → start copy mode
# 2) (any cursor movements) → defines selection start position
# 3) v → begin selection
# 4) (any cursor movements) → defines selection end position
# 5) <ENTER> → selection goes to tmux'es copy buffer
# 6) ^A ] → paste buffer at current cursor position
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
# last pane, last window
bind-key Tab last-pane
bind-key C-a last-window
# I always have CTRL still down from the prefix, so plain n/p is not enough:
bind-key C-n next-window
bind-key C-p previous-window
# hjkl pane traversal
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# HJKL pane resizing
bind-key H resize-pane -L 4
bind-key J resize-pane -D 4
bind-key K resize-pane -U 4
bind-key L resize-pane -R 4
# splitting with s (horizontal) and v (vertical), like in vim
bind-key s split-window
bind-key v split-window -h
# default was s, but I need this for splitting
bind-key S choose-tree
# reload config
bind-key r source-file ~/.tmux.conf
# let message show for a longer time (4 sec.)
set-option -g display-time 4000
# auto window rename
set-window-option -g automatic-rename
# rm mouse mode fail
set -g mouse off
# terminal crap
# At least with mintty, it seems the following works (256colors2.pl & vim ok):
# .minttyrc:
# Term=rxvt-unicode-256color
# .tmux.conf:
set -g default-terminal "screen-256color"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment