From 5e2f50b4ad25ecc23d9c022a297a4c62c82df8a0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 22 Jul 2013 17:36:58 +1200 Subject: Comment .tmux.conf more helpfully --- tmux/tmux.conf | 96 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 24 deletions(-) (limited to 'tmux') diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 92e93415..38a64bc7 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,89 +1,137 @@ -# Environment +# My tmux session is no-display land because I attach to it with all sorts of +# terminal clients, including PuTTY, so I don't always have X forwarding +# available and therefore it's not appropriate to set the display set-environment -gru DISPLAY -set-environment -g BROWSER lynx + +# The only environment variable I want tmux to update for me is SSH_CONNECTION, +# which is occasionally useful set-option -g update-environment SSH_CONNECTION -# Shell/command +# Setting this prevents each new pane being a login shell, purely for +# efficiency reasons; I've not yet encountered a situation where I need tmux to +# create login shells set-option -g default-command $SHELL # All of my terminals are 256 colors, so use the appropriate termcap/terminfo set-option -g default-terminal 'screen-256color' -# Prefix +# Change the prefix to ^A rather than the default of ^B, because I'm a godless +# GNU Screen refugee, and also I like using ^B in my shell and in Vim more unbind-key C-b set-option -g prefix C-a bind-key a send-prefix + +# Repeating the prefix switches to the last window and back, a GNU Screen +# feature that's hardwired into my brain now bind-key C-a last-window -# Bindings +# Quick ways to kill single windows and the whole server bind-key '/' confirm-before 'kill-window' bind-key '\' confirm-before 'kill-server' + +# Slightly more intuitive way to split windows bind-key '_' split-window -v bind-key '|' split-window -h + +# Switch to the last active pane bind-key Tab last-pane -# Vim-like pane resize +# Use the vi mode for tmux interaction behaviour in copy and choice modes +set-window-option -g mode-keys vi + +# Vim-like pane resizing bind-key -r '+' resize-pane -U 5 bind-key -r '-' resize-pane -D 5 bind-key -r '<' resize-pane -L 5 bind-key -r '>' resize-pane -R 5 -# Allow repeats for next/prev window +# Vim-like pane switching +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +# Allow repeats for moving to the next and previous windows, allows me to tap +# through a list of windows quickly; good for clearing alerts bind-key -r n next-window bind-key -r p previous-window -# Vim-like select/yank +# Vim-like keys for visual mode and yanking therefrom bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy 'y' copy-selection bind-key -t vi-copy Escape cancel -# Vim-like pane switching -bind-key h select-pane -L -bind-key j select-pane -D -bind-key k select-pane -U -bind-key l select-pane -R - # Join and break panes bind-key J choose-window "join-pane -h -s '%%'" bind-key B break-pane -d -# Choose only sessions, don't care about windows +# Select only sessions in the choose-tree menu, not the whole tree of sessions +# and windows, I prefer to drill down bind-key s choose-session -# Activity +# Show a sigil in the window title when activity set-window-option -g monitor-activity on set-window-option -g window-status-activity-attr none -# Status bar +# Session title on the left side of the status bar set-option -g status-left '[#S]' + +# Hostname and the current date on the right side of the status bar set-option -g status-right '[#H] #(date +"%F %T")' -# Miscellaneous +# The first window in a session has index 1, rather than 0 set-option -g base-index 1 + +# Don't worry about timeouts for key combinations, as I don't use Escape as +# meta and prefer things to be snappier set-option -g escape-time 0 + +# Keep plenty of history set-option -g history-limit 100000 + +# Don't interfere with my system clipboard set-option -g set-clipboard off + +# Only force individual windows to the smallest attached terminal size, not +# whole sessions set-window-option -g aggressive-resize on -set-window-option -g allow-rename off + +# If I don't set a title on a window, use the program name for the window title set-window-option -g automatic-rename on -set-window-option -g mode-keys vi -# Formatting +# However, don't let terminal escape sequences rename my windows +set-window-option -g allow-rename off + +# Window titles are the window index, a colon, the window or command name, and +# any activity or alert indicators set-window-option -g window-status-format "#I:#W#F" -# Colors +# Message dialogs are white on blue set-option -g message-bg colour18 set-option -g message-fg colour231 + +# Window choosers are white on blue +set-window-option -g mode-bg colour18 +set-window-option -g mode-fg colour231 + +# Pane borders are in dark gray, active or not set-option -g pane-active-border-fg colour237 set-option -g pane-border-fg colour237 + +# The status bar defaults to light gray on dark gray, which applies to the left +# and right status bar sections described in status-left and status-right above set-option -g status-bg colour237 set-option -g status-fg colour248 -set-window-option -g mode-bg colour18 -set-window-option -g mode-fg colour231 + +# Titles of windows default to black text with no embellishment set-window-option -g window-status-attr none set-window-option -g window-status-fg colour16 + +# The title of the active window is in white rather than black set-window-option -g window-status-current-attr none set-window-option -g window-status-current-fg colour231 + +# A window with a bell has a title with a red background until cleared set-window-option -g window-status-bell-attr none set-window-option -g window-status-bell-bg colour9 -- cgit v1.2.3