comulinux
5/30/2016 - 11:41 AM

Tmux config

# UTF8 y lineas de historico:
set -g status-utf8 on                       # enable utf-8
set -g history-limit 100000                 # scrollback buffer n lines

# Ademas de Ctrl+B, agregamos un atajo de teclado tipo screen (Ctrl+A)
# Para tmux < 1.6:
set-option -g prefix C-a,C-b

# Para tmux >= 1.6:
#set-option -g prefix C-a
#set-option -g prefix2 C-b

# Si quisieramos reemplazarlo totalmente:
# set-option -g prefix C-a

# Empezar la numeración de las ventanas creadas en 1 (la primera ventana)
set -g base-index 1

# Reducir el tiempo de espera para secuencias de escape en los comandos
set -s escape-time 0

# Si corremos un tmux dentro de otro, como enviar comandos al más interno (C-A C-A comando)
bind-key a send-prefix

# Pasar a modo buffer con C-A espacio ademas de con [ y RePag
bind-key Space copy-mode

# Partir ventanas intuitivamente con | y -
unbind %
bind | split-window -h
bind - split-window -v

# Establecer barra de estado personalizada
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=green]#H"

# Los colores se pueden especificar en RRGGBB:

# set -g default-terminal "screen-256color"
# set -g status-bg '#4d4d4d'
# set -g status-fg '#ffffff'
# setw -g window-status-current-bg '#54dd54'
# setw -g window-status-current-fg '#000000'
# set -g pane-active-border-fg '#aaaaaa'
# set -g pane-border-fg '#444444'

# Tambien se pueden especificar en valores colour0 a colour255:
# set -g status-bg colour200

# bind to reload config (thanks to gentoo wiki :)
bind r source-file ~/.tmux.conf

# Iluminar de rojo en la barra de estado la ventana activa ademas del "*"
set-window-option -g window-status-current-bg red

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

tmux new -s myname

attach:

tmux a  #  (or at, or attach)

attach to named:

tmux a -t myname

list sessions:

tmux ls

kill session:

tmux kill-session -t myname

In tmux, hit the prefix ctrl+b and then:

Sessions

:new<CR>  new session
s  list sessions
$  name session

Windows (tabs)

c           new window
,           name window
w           list windows
f           find window
&           kill window
.           move window - prompted for a new number
:movew<CR>  move window to the next unused number

Panes (splits)

%  horizontal split
"  vertical split

o  swap panes
q  show pane numbers
x  kill pane
⍽  space - toggle between layouts

Window/pane surgery

:joinp -s :2<CR>  move window 2 into a new pane in the current window
:joinp -t :1<CR>  move the current pane into a new pane in window 1

Misc

d  detach
t  big clock
?  list shortcuts
:  prompt

Resources:

Notes:

  • You can cmd+click URLs to open in iTerm.

TODO:

  • Conf copy mode to use system clipboard. See PragProg book.