# Use `Ctrl-A` as the tmux command prefix instead of `Ctrl-B`. unbind C-b set-option -g prefix C-a # Report the same $TERM value as we use for our terminal emulator (yes, go and # set this) This influences, among other things, certain vim settings related to # colours, rendering speed and mouse support. set -g default-terminal "xterm-256color" # Start windows and panes from `1`, not `0`. set-option -g base-index 1 set-option -g pane-base-index 1 # History scrollback. set-option -g history-limit 9999999 # Display a status line message when activity occurs in a window for which the # monitor-activity window option is enabled. set-option -g visual-activity on # Resize the window to the size of the smallest session for which it is the # current window, rather than the smallest session to which it is attached. set-window-option -g aggressive-resize on # Mouse Support! (for scrollback, and lazy manipulation of windows/panes) # At least with iTerm2, this plays very well with vim mouse support :D Yay! # Note: text-selection by default does a tmux copy (paste with prefix+]). # Hold alt/meta/option for system selection/copy. set-option -g mode-mouse on set-option -g mouse-select-pane set-option -g mouse-resize-pane on set-option -g mouse-select-window on # Act like vim. set-option -g status-keys vi set-window-option -g mode-keys vi # vi keys in copy mode (prefix+[) ####################### # General Key Bindings ####################### # Act like vim. Enhance copy mode to use more vim like keys for copying. bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy 'y' copy-selection # Use prefix+r to reload the config file. bind-key C-r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded" # Detach client like screen, . bind-key C-d detach-client ################################### # Window/Pane/Session Manipulation ################################### # Window Movement. bind-key -r C-h previous-window bind-key -r C-l next-window bind-key C-a last-window bind-key -n M-1 select-window -t 1 bind-key -n M-2 select-window -t 2 bind-key -n M-3 select-window -t 3 bind-key -n M-4 select-window -t 4 bind-key -n M-5 select-window -t 5 bind-key -n M-6 select-window -t 6 bind-key -n M-7 select-window -t 7 bind-key -n M-8 select-window -t 8 bind-key -n M-9 select-window -t 9 bind-key -n M-0 select-window -t 10 # Window Creation/Destruction. bind-key C-c new-window # Remember prefix+, for renaming windows. # Pane Movement. bind-key h select-pane -L bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R # Pane Creation/Destruction. unbind % # Remove default binding for horizontal split since we’re replacing it. bind-key -n C-\ split-window -h bind-key -n C-_ split-window -v bind-key C-x kill-pane # Pane Sychronisation. bind-key s set -w synchronize-panes # Session Switching/Destruction. bind-key C-s choose-session bind-key X kill-session # Remember prefix+$ for renaming sessions. ######################## # Visual ######################## # Use solarized colour palette. source ~/dotfiles/tmux/tmux-colors-solarized/tmuxcolors-256.conf ######################## # Powerline ######################## # While the default way of using powerline is something like: # # source ~/dotfiles/powerline/powerline/powerline/bindings/tmux/powerline.conf # # we would rather roll our own not-so-blue-and-annoying color scheme, so we have # to replicate the contents of that file, with adjustments. # # TODO is it possible to rework this into a powerline config in `~/.config/powerline`? if-shell 'test -z "$POWERLINE_COMMAND"' 'set-environment -g POWERLINE_COMMAND powerline-render' set -g status on set -g status-utf8 on set -g status-interval 2 # Central window list. set -g status-justify "centre" set -g status-fg colour231 set -g status-bg colour234 # `#I` = index, `#F` = last window indicator, `#W` = window name set -g window-status-format " #[fg=colour244]#I#[fg=red]#F#[fg=colour249]#W " set -g window-status-current-format "#[fg=red,bg=red] #[fg=colour231]#I #[bold]#W#[fg=red,nobold] " # Left status. set -g status-left-length 90 set -g status-left '#[fg=colour189,bg=colour55] #S #[fg=colour55,bg=colour233]#(eval $POWERLINE_COMMAND tmux left)' # Right status. set -g status-right-length 90 set -g status-right '#(eval $POWERLINE_COMMAND tmux right) #(~/dotfiles/tmux/rainbarf/rainbarf --remaining --rgb --width 10)' # Some instructions above are deprecated in 1.9+ so rewrite them where necessary. if-shell '[[ `tmux -V` == *1.9* ]]' 'source ~/dotfiles/tmux/tmux19.conf' # vim: ft=tmux