# use utf-8 set -g utf8 setw -g utf8 on # general settings setenv -g PATH "/usr/local/bin:$PATH" set -g default-shell $SHELL set -g default-terminal "screen-256color" set -g history-limit 100000 set -s escape-time 0 # window numbering set -g base-index 1 setw -g pane-base-index 1 set -g renumber-windows on set -g automatic-rename on # mouse set -g mode-mouse on setw -g mouse-select-window on setw -g mouse-select-pane on setw -g mouse-resize-pane on # act like GNU screen unbind C-b unbind C-a bind C-a send-prefix set -g prefix C-a # act like Vim setw -g mode-keys vi unbind [ unbind v bind v copy-mode unbind p bind p paste-buffer # I hit this accidentally all the time unbind C-z bind C-z resize-pane -Z # main window at the top, splits at the bottom unbind = bind = select-layout main-horizontal\; run "tmux resize-pane -t1 -y$((#{session_height} * 2/3))" # keep pwd when splitting and creating new windows unbind c bind c new-window -c "#{pane_current_path}" unbind % bind % split-window -h -c "#{pane_current_path}" unbind '"' bind '"' split-window -c "#{pane_current_path}" # copy and paste set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" unbind p bind p run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer" unbind -t vi-copy v bind -t vi-copy v begin-selection unbind -t vi-copy y bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" unbind -t vi-copy Enter bind -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" unbind y bind y run "tmux show-buffer | reattach-to-user-namespace pbcopy" # smart pane switching with awareness of vim splits unbind C-h bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h; ) || tmux select-pane -L" unbind C-j bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j; ) || tmux select-pane -D" unbind C-k bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k; ) || tmux select-pane -U" unbind C-l bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l; ) || tmux select-pane -R" unbind C-\\ bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\'; ) || tmux select-pane -l" # window resizing bind -r C-h resize-pane -L bind -r C-j resize-pane -D bind -r C-k resize-pane -U bind -r C-l resize-pane -R # colors set -g pane-border-bg colour0 set -g pane-border-fg colour10 set -g pane-active-border-bg colour0 set -g pane-active-border-fg colour1 # status line set -g status-utf8 on set -g status-position bottom set -g status-bg colour10 set -g status-fg colour241 set -g status-left '' set -g status-right '#(date +"%a %d %b %H:%M") ' set -g status-justify left set -g window-status-format ' #I·#W' set -g window-status-current-format ' #I·#W' set -g window-status-current-fg colour4 set -g window-status-current-bg colour10 # reload tmux.conf bind r source-file ~/.tmux.conf \; display "Reloaded!" # create new session if none exists if-shell "[[ -z $(tmux list-sessions) ]]" new-session # local config if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'