Skip to content

Instantly share code, notes, and snippets.

@vincentbernat
Created April 25, 2016 16:41
Show Gist options
  • Save vincentbernat/4e3f8e1d172911c0a90417585910c3ae to your computer and use it in GitHub Desktop.
Save vincentbernat/4e3f8e1d172911c0a90417585910c3ae to your computer and use it in GitHub Desktop.
# Use backtick as hotkey
unbind C-b
set -g prefix `
bind-key ` send-prefix
## Options
# Use screen-256color for $TERM
set -g default-terminal "screen-256color"
# True color support
set -ga terminal-overrides ",xterm-256color:Tc"
# Set scrollback to 10000
set -g history-limit 10000
# Start numbering from 1
set -g base-index 1
# Don't bell
set -g bell-action none
# Window titles
set -g set-titles on
set -g set-titles-string "#T"
setw -g automatic-rename off
# Keep messages longer
set -g display-time 2000
# Resize windows to smaller active client
setw -g aggressive-resize on
# Mouse handling
setw -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
## Status line
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
set -g status-right '#[fg=colour39,bg=colour234,nobold]#[fg=colour235,bg=colour39,noreverse,bold] #D #[fg=colour252,bg=colour39,nobold]#[fg=colour235,bg=colour252,bold] #h '
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour234,nobold] '
set -g window-status-format "#[fg=white,bg=colour234] #I #{=20:window_name} "
set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour235,bg=colour39,noreverse,bold] #I #[nobold]#[bold] #{=30:window_name} #[fg=colour39,bg=colour234,nobold]"
## Key bindings
# Kill a chosen session
bind-key k choose-tree -b "kill-session -t '%%'"
# Replace the current session (in fact pane) with a chosen session
bind-key S choose-tree -b "run-shell \"~/.tmux.d/kill-and-switch '%%'\""
# Clipboard integration
bind C-c run -b "tmux save-buffer - | xclip -i -selection clipboard -silent"
bind ] paste-buffer -p
# Start in the current directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Record a session (like screen)
bind-key H pipe-pane -o "exec cat >>$HOME/tmp/'#I-tmux.log'"
## Cluster SSH
bind C-s setw synchronize-panes
# for h in ...; do tmux splitw "ssh $h" ; done
# close the "foreign window"
# select-layout tiled
# set-window-option synchronize-panes on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment