[...] access multiple separate login sessions inside a single terminal window, or detach and reattach sessions from a terminal.
It is a wrapper that allows multiple text programs to run at the same time, and provides features that allow the user to use the programs within a single interface productively.
# Set prefix to C-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Bind prefix-R to reload configuration
bind R source-file '~/.tmux.conf' \; display-message "Tmux reloaded!"
# Enable mouse
set-option -g -q mouse on
# Use C-h/j/k/l to switch panes
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# Caveat: guaranteed not to work...
tmux new-session -A -d -s bmx-api -n editor -c /home/marko/source/butterflymx/bmx-api/
tmux send-keys -t bmx-api 'vim' C-m
tmux new-window -n shell -t bmx-api -c /home/marko/source/butterflymx/bmx-api/
tmux new-window -n webpack -t bmx-api -c /home/marko/source/butterflymx/bmx-api/
tmux split-window -v -t bmx-api:1
tmux split-window -h -t bmx-api:1.1
tmux send-keys -t bmx-api:1.1 'rails s' C-m
tmux send-keys -t bmx-api:1.2 'rails c' C-m
tmux select-window -t bmx-api:0
tmux attach -t bmx-api
name: bmx-api
root: /home/marko/source/butterflymx/api-rails4
# startup_window: 0
windows:
- editor: vim
- shell:
layout: 4a73,271x70,0,0{135x70,0,0,1,135x70,136,0[135x35,136,0,3,135x34,136,36,5]}
panes:
-
- rails s
- rails c
- webpack:
Marko Ivanek
Rails Engineer @ ButterflyMX
Occasional consultant
markoivanek@gmail.com