Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
157 lines (124 sloc) 4.7 KB
# Tmux configuration
#
# See also:
# - http://man.openbsd.org/OpenBSD-current/man1/tmux.1
# - https://github.com/claytron/dotfiles/blob/master/.tmux.conf
# - https://github.com/dariomanesku/.tmux/blob/master/.tmux.conf
# - https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# Always use UTF-8.
setw -gq utf8 on
# Set the default terminal.
# This improves vim/emacs usage inside tmux.
# https://gist.github.com/limingjie/4975c36d13d0927613e6
# set -g default-terminal "xterm-256color"
set -g default-terminal "screen-256color"
# Remap prefix from 'C-b' to 'C-a'.
# This might interfere with bash's go to beginning of line command.
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Split panes using '|' and '-' instead of '"' and '%'.
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# Use vi key bindings.
setw -g mode-keys vi
# Set the indexes to start at 1 instead of 0.
set -g base-index 1
setw -g pane-base-index 1
# Set the delay so that it doesn't interfere with vim.
set -sg escape-time 0
# Set the scrollback.
set -g history-limit 200000
# Colors =======================================================================
# Status bar colors.
set -g status-fg white
set -g status-bg black
set -g status-attr bright
# Default window title colors.
set-window-option -g window-status-fg white
set-window-option -g window-status-bg black
set-window-option -g window-status-attr dim
# Active window title colors.
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg magenta
set-window-option -g window-status-current-attr bright
# Set the pane border.
# set -g pane-border-bg black
set -g pane-border-fg white
# set -g pane-active-border-bg black
set -g pane-active-border-fg magenta
# Set inactive/active window styles.
# These are useful sometimes but can be distracting.
# set -g window-style 'fg=colour247,bg=colour236'
# set -g window-active-style 'fg=colour250,bg=black'
# Version-specific =============================================================
# See also:
# - https://github.com/tmux/tmux/blob/master/CHANGES
# - https://stackoverflow.com/questions/35016458
# tmux 2.1+ can selectively color the active pane.
# Can use xterm-256 colors or ANSI.
# - http://www.deanbodenham.com/learn/tmux-pane-colours.html
# - https://stackoverflow.com/a/33562182
# - https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
# Enable mouse mode.
# Renamed from `mouse-mode` to simply `mouse` in tmux v2.1.
# Note that this can conflict with vim mouse mode.
# PuTTY on Windows
# Hold SHIFT, left-click select text, and right-click to paste.
# setw -g mouse on
# Enable mouse mode.
# < 2.1
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.1" | bc)" = 1 ]' \
"set -g mouse-select-pane on; \
set -g mode-mouse on; \
set -g mouse-resize-pane on; \
set -g mouse-select-window on"
# >= 2.1: "mouse" replaced the previous 4 mouse options.
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' \
"set -g mouse on"
# 2.2+: UTF-8 is autodetected, but errors if explicitly set.
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' \
"set -g utf8 on; \
set -g status-utf8 on; \
set -g mouse-utf8 on"
# Change bind keys.
# < 2.4: bind-key syntax changed in 2.4.
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key -t vi-copy v begin-selection; \
bind-key -t vi-copy V select-line; \
bind-key -t vi-copy C-v rectangle-toggle; \
bind-key -t vi-copy y copy-pipe 'xclip -selection clipboard -in'"
# >= 2.4
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
"bind-key -T copy-mode-vi v send -X begin-selection; \
bind-key -T copy-mode-vi V send -X select-line; \
bind-key -T copy-mode-vi C-v send -X rectangle-toggle; \
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -selection clipboard -in'"
# Potentially useful ===========================================================
# Don't hold the size of the smallest client bounds.
# setw -g aggressive-resize on
# Enable screen mode.
# set -g prefix C-a
# unbind C-b
# Allow for C-a C-a to send it to the application.
# bind C-a send-prefix
# Allow renaming of window title.
# set-window-option -g automatic-rename on
# Set titles.
# set -g set-titles on
# set -g set-titles-string '#W' #T
# Notify if other windows have activity.
# setw -g monitor-activity on
# set -g visual-activity on
# Set default directory path.
# set-option default-path "$PWD"
# Set screen-like prefix.
# set -g prefix ^t
# bind-key ^t last-window
# Set default shell as ZSH instead of bash.
# set -g default-shell /bin/zsh
# set -g default-command /bin/zsh
# Don't erase terminal contents on editor exit.
# set-window-option -g alternate-screen on