~~~~~~~~~~~~~~~
tmux depends on libevent 2.x. Download it from: http://www.monkey.org/~provos/libevent/
cd libevent/
./configure --prefix=/home/robert/opt
make && make install
You may need to modify:
LD_LIBRARY_PATH ="~/opt/lib:$LD_LIBRARY_PATH "
# For tmux 2.9a
cd tmux/
export CPPFLAGS='-I/home/robert/opt/include' LDFLAGS='-L/home/robert/opt/lib'
autoconf
./configure --prefix=/home/robert/opt
make
make install
Tmux config [~/.tmux.conf]
~~~~~~~~~~~~~
Make it screen-key compatible & vim-like split :
> cat examples/screen-keys.conf examples/vim-keys.conf >~/.tmux.conf
Append to do my customization:
> vi ~/.tmux.conf
############################################
#robert
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# kill pane (overwrite lock-server in screen-keys.conf)
unbind x
bind x kill-pane
# window previous/next/rename
unbind -n F10
bind -n F10 command-prompt "rename-window %%"
unbind -n F11
bind -n F11 previous-window
unbind -n F12
bind -n F12 next-window
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ''
set -g status-right '%H:%M %d/%b/%Y'
# Highlight active window
# before tmux 2.9
#set-window-option -g window-status-current-attr bright
#set-window-option -g window-status-current-bg blue
#set-window-option -g window-status-current-fg yellow
#set-window-option -g window-status-fg red
# after tmux 2.9
set -g window-status-current-style bright,bg=blue,fg=yellow
set -g window-status-style fg=red
# window-status format -- default is ‘#I:#W#F’
set -g window-status-format '#I #W '
set -g window-status-current-format '#I #W '
# new windows and pane split keep your current directory
bind-key c new-window -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
# swap window with the left/right window
unbind -n F7
bind -n F7 swap-window -t -1
unbind -n F8
bind -n F8 swap-window -t +1
For more STYLES, search STYLES in "tmux man".
Tutorial
~~~~~~~
Help:
CTL-a ?
1. Session
You create a session.
> tmux
> tmux ls
0: 1 windows (created Sat Dec 12 15:04:45 2015) [143x38] (attached)
Detach (but not delete) this session:
CTL-a d
Attach to previous session:
> tmux a
2. Window
You can have multiple windows.
But only one window can show at a time.
Create a new window:
CTL-a c
Go to previous window:
CTL-a p
Go to next window:
CTL-a n (or space)
Rename a window:
CTL-a A
Kill window:
CTL-a K
3. Pane
And panes in a window can show at the same time.
Vertically splitting a window to create a pane:
CTL-a v
Horizontally:
CTL-a s
Move the current pane to a new window:
CTL-a !
5. Server
Kill tmux server:
CTL-a \
Tmux script for project
~~~~~~~~~~~~~~~~~~
My tmux script will
* create a session
* create several windows
> vi tmux_open.sh
###########################
#!/bin/bash
tmux start-server
tmux new-session -d -s OK
tmux rename-window win1
tmux new-window -n win2 -c ~/work/xx1
tmux new-window -n win3 -c ~/work/xx2
tmux select-window -t 0
tmux attach
ref:
* How to add libraries path to the ./configure command?
http://askubuntu.com/questions/386315/how-to-add-libraries-path-to-the-configure-command
* 進化版screen
http://forum.j2eemx.com/forum44/thread9789.html
* Tmux 教學 + Screen 到 Tmux 的無痛轉換
http://blog.longwin.com.tw/2011/04/tmux-learn-screen-config-2011/
* A sample to customize status bar
http://dotshare.it/dots/830/
* simple tmux configuration
http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/