Basic configuration for tmux

Tmux canbe configured via .tmux.conf file within the home directory. The following .tmux.conf contains a basic configuration.

# ~/.tmux.conf

set -g default-terminal "screen-256color"   # use 256 colors
set -g history-limit 65536                  # scrollback buffer n lines
set -g default-command zsh                  # disable login-shell

# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix

# Bind appropriate commands similar to screen.
# lockscreen ^X x 
unbind ^X
bind ^X lock-server
unbind x
bind x lock-server

# screen ^C c 
unbind ^C
bind ^C new-window
unbind c
bind c new-window

# detach ^D d
unbind ^D
bind ^D detach

# displays * 
unbind *
bind * list-clients

# next ^@ ^N sp n 
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window

# title A
unbind A
bind A command-prompt "rename-window %%"

# other ^A
unbind ^A
bind ^A last-window

# prev ^H ^P p ^? 
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window

# windows ^W w 
unbind ^W
bind ^W list-windows
unbind w
bind w list-windows

# quit \ 
unbind '\'
bind '\' confirm-before "kill-server"

# kill K k 
unbind K
bind K confirm-before "kill-window"
unbind k
bind k confirm-before "kill-window"

# redisplay ^L l 
unbind ^L
bind ^L refresh-client
unbind l
bind l refresh-client

# split -v |
unbind |
bind | split-window

# :kB: focus up
unbind Tab
bind Tab select-pane -t:.+
unbind BTab
bind BTab select-pane -t:.-

# " windowlist -b
unbind '"'
bind '"' choose-window

# Powerline
source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
# alternatively absolute path to HOME
# Rainbarf
set -g status-left '#(rainbarf --battery --remaining --rgb)'

Basic tmux commands

To start a new tmux terminal, the following command forces the terminal to assume that it supports 256 colors.

> tmux -2

The following commands represent a few basics (based on the configuration from above):

STRG-A This prefix key starts a new commands and will be followed by a command key. (Default prefix key is STRG-B)
STRG-A ↑(Picture upwards) Scrolling mode (Leave via `Enter`)
STRG-A D Detach to background (tmux -2 attach (hold back to foreground))
STRG-A C Create a new terminal witin tmux
STRG-A | Vertical split of the screen
STRG-A % Horizontal split of the screen
STRG-A(hold it) + ArrowKeys Change the size of the terminals

Leave a Reply