Skip to content

Instantly share code, notes, and snippets.

@stasiek
Last active December 25, 2015 14:58
Show Gist options
  • Select an option

  • Save stasiek/6994497 to your computer and use it in GitHub Desktop.

Select an option

Save stasiek/6994497 to your computer and use it in GitHub Desktop.
tmux config made from examples
# Terminal settings
set -g default-terminal "xterm-256color"
enable utf-8 on status bar
set -g status on
set -g status-utf8 on
set -g status-bg green
set -g status-right "%H:%M" # %d-%b-%y
set -g bell-action none
set -g lock-after-time 1800
# Default global window options.
setw -g remain-on-exit on
setw -g window-status-current-attr "underscore"
#setw -g xterm-keys on
# Prefix key.
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Keys to switch session.
bind Q switchc -t0
bind W switchc -t1
bind E switchc -t2
# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix
# toggle last window like screen
bind-key C-a last-window
# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server
# toggle statusbar
bind-key b set-option status
# ctrl+left/right cycles thru windows
bind-key -n C-right next
bind-key -n C-left prev
# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"
# quick view of processes
bind '~' split-window "exec htop"
# scrollback buffer n lines
set -g history-limit 5000
# listen for activity on all windows
set -g bell-action any
# on-screen time for display-panes in ms
set -g display-panes-time 2000
# start window indexing at one instead of zero
set -g base-index 1
# enable wm window titles
set -g set-titles on
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux.#I.#W"
# Other key bindings.
bind F1 selectw -t:10
bind F2 selectw -t:11
bind F3 selectw -t:12
bind F4 selectw -t:13
bind F5 selectw -t:14
bind F6 selectw -t:15
bind F7 selectw -t:16
bind F8 selectw -t:17
bind F9 selectw -t:18
bind F10 selectw -t:19
bind F11 selectw -t:20
bind F12 selectw -t:21
bind m setw monitor-activity
bind y setw force-width 81
bind u setw force-width 0
bind -n F1 run-shell 'mpc -h 192.168.1.191 toggle >/dev/null 2>&1'
bind -n F2 run-shell 'mpc -h 192.168.1.191'
bind -n F3 run-shell 'mpc -h 192.168.1.191 prev >/dev/null 2>&1'
bind -n F4 run-shell 'mpc -h 192.168.1.191 next >/dev/null 2>&1'
bind -n F5 run-shell 'mpc -h 192.168.1.191 volume -5 >/dev/null 2>&1'
bind -n F6 run-shell 'mpc -h 192.168.1.191 volume +5 >/dev/null 2>&1'
# Hide and show window name from status line
bind '-' setw window-status-format '#I'\; setw window-status-current-format '#I'
bind '+' setw window-status-format '#I:#W#F'\; setw window-status-current-format '#I:#W#F'
############################################
# VIM keybindings!
############################################
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# vi-style controls for copy mode
setw -g mode-keys vi
# First session.
new -d -s0 -ntodo 'exec vim ~/.TODO'
setw -t0:0 monitor-activity on
setw -t0:0 aggressive-resize on
set -t0 status-bg green
neww -d -ntodo2 'exec vim ~/.TODO2'
setw -t0:1 aggressive-resize on
neww -d -nncmpcpp 'exec ncmpcpp -h 192.168.1.191'
setw -t0:2 aggressive-resize on
neww -d -nhtop 'exec htop'
setw -t0:3 aggressive-resize on
neww -d -nsys.log 'exec tail -f /private/var/log/system.log'
setw -t0:4 aggressive-resize on
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
# Second session.
new -d -s1
set -t1 status-bg cyan
linkw -dk -t0 -s0:0
linkw -dk -t1 -s0:1
linkw -dk -t2 -s0:2
linkw -dk -t3 -s0:3
linkw -dk -t4 -s0:4
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
# Third session.
new -d -s2
set -t2 status-bg yellow
linkw -dk -t0 -s0:0
linkw -dk -t1 -s0:1
linkw -dk -t2 -s0:2
linkw -dk -t3 -s0:3
linkw -dk -t4 -s0:4
neww -d
neww -d
neww -d
neww -d
neww -d
neww -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment