Skip to content

Instantly share code, notes, and snippets.

@urban
Last active December 21, 2015 02:09
Show Gist options
  • Save urban/6232602 to your computer and use it in GitHub Desktop.
Save urban/6232602 to your computer and use it in GitHub Desktop.
Custom tmux configuration
# utf8
set-window-option -g utf8 on
# fix the titles
set -g set-titles on
set -g set-titles-string "#I:#W"
# 1-based window indexing
set -g base-index 1
# switch currently focused pane by mouse click
setw -g mode-mouse on
set-option -g mouse-select-pane on
# increase history to 100k
set -g history-limit 100000
# aggressive resize
setw -g aggressive-resize on
# load custom key bindings
source-file ~/.tmux.keys
# remap prefix to match GNU screen (i.e. CTRL+a)
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# make the split panes more mnemonic
unbind '"'
unbind %
bind \ split-window -h
bind - split-window -v
# split the window into two vertical panes
prefix + "
# split the window into two horizontal panes
prefix + %
# swap pane with another in the specific direction
prefix + { or }
# select the next pane in the specified direction (arrow keys)
prefix + [UDLR]
# toggle between pane layouts (space key)
prefix + ⍽
# for scrolling, enter copy-mode and then use arrow keys and exit w/ ESC
prefix + [
# kill the current pane
prefix + x
# start new
tmux
# starts a new session session_name
tmux new -s session_name (prefix + :new -s session_name)
# starts a new session name the same as current directory
tmux new -s `basename $PWD`
# attach
tmux a # (or at, or attach)
# attach to an existing session named session_name
tmux attach -t session_name
tmux a -t session_name
# switch to an existing session named session_name
tmux switch -t session_name
# lists existing sessions
tmux list-sessions (prefix + s)
tmux ls
# detach the currently attached session
tmux detach (prefix + d)
# kill session
tmux kill-session -t session_name
# rename session
prefix + $
# create a new window
prefix + c
# list windows / window numbers
prefix + w
# move to the window based on index
prefix + 0-9
# rename the current window
prefix + ,
# kill the current window
prefix + &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment