|
# color needs to be set early in tmux 1.8 for some reason |
|
set -g default-terminal "screen-256color" |
|
|
|
set -g default-shell /bin/zsh |
|
set -g default-command /bin/zsh |
|
|
|
# Fix scrolling |
|
set -g terminal-overrides 'xterm*:smcup@:rmcup@' |
|
|
|
# set window split |
|
bind-key '"' split-window -v |
|
bind-key % split-window -h |
|
|
|
# detach |
|
bind-key C-d detach-client |
|
|
|
# Make C-a q kill the pane (simular to GNU screen) |
|
bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane |
|
|
|
# cycle windows |
|
bind-key C-n next-window |
|
bind-key C-p previous-window |
|
|
|
# status bar |
|
set -g status on |
|
set -g status-keys emacs |
|
set -g status-interval 10 |
|
set -g status-justify centre |
|
set -g status-left-length 40 |
|
set -g status-left "#[fg=brightblack]|#[fg=green]#h#[fg=brightblack]|#[fg=brightblue]#(ip r g 8.8.8.8 | sed -rne 's/ uid.*//' -e 's/.*src //p' | xargs)#[fg=brightblack]|" |
|
set -g status-right-length 30 |
|
set -g status-right "#[fg=brightblack]|#[fg=brightblue]#S #I:#P#[fg=brightblack]|#[fg=green]%b/%d#[fg=brightblack]|#[fg=green]%H:%M#[fg=brightblack]|" |
|
|
|
# C-b is not acceptable -- Vim uses it |
|
set-option -g prefix C-a |
|
bind-key C-a last-window |
|
|
|
# Start numbering at 1 |
|
set -g base-index 1 |
|
set -g pane-base-index 1 |
|
|
|
# Allows for faster key repetition |
|
set -s escape-time 0 |
|
|
|
# Rather than constraining window size to the maximum size of any client |
|
# connected to the *session*, constrain window size to the maximum size of any |
|
# client connected to *that window*. Much more reasonable. |
|
setw -g aggressive-resize on |
|
|
|
# Allows us to use C-a a <command> to send commands to a TMUX session inside |
|
# another TMUX session |
|
bind-key a send-prefix |
|
|
|
# Activity monitoring |
|
setw -g monitor-activity on |
|
set -g visual-activity on |
|
|
|
# hjkl pane traversal |
|
bind h select-pane -L |
|
bind j select-pane -D |
|
bind k select-pane -U |
|
bind l select-pane -R |
|
|
|
bind C-h select-pane -L |
|
bind C-j select-pane -D |
|
bind C-k select-pane -U |
|
bind C-l select-pane -R |
|
|
|
# HJKL pane swapping in that direction |
|
# (NOTE: tmux doesn't support swap -L or -R) |
|
#bind H swap-pane -L |
|
bind J swap-pane -D |
|
bind K swap-pane -U |
|
#bind L swap-pane -R |
|
|
|
# resize like in vim |
|
# https://github.com/hatoishi/dotfiles/blob/master/tmux.conf |
|
bind < resize-pane -L 10 |
|
bind > resize-pane -R 10 |
|
bind - resize-pane -D 10 |
|
bind + resize-pane -U 10 |
|
|
|
# full-screen a pane (toggle) |
|
# http://blog.sanctum.geek.nz/zooming-tmux-panes/ |
|
bind z resize-pane -Z |
|
|
|
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" |
|
|
|
# reload config |
|
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." |
|
|
|
# auto window rename |
|
set-window-option -g automatic-rename |
|
|
|
# logging toggle |
|
# https://unix.stackexchange.com/questions/5832/is-there-an-equivalent-of-gnu-screens-log-command-in-tmux |
|
#bind-key H pipe-pane -o "exec cat >>$HOME/'#W-tmux.log'" '\;' display-message 'Toggled logging to $HOME/#W-tmux.log' |
|
bind-key H { pipe-pane -o "exec cat >>$HOME/'#W-tmux.log'" ; display-message 'Toggled logging to $HOME/#W-tmux.log' } |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
# https://github.com/neovim/neovim/issues/2093 |
|
set -g escape-time 20 |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
if-shell "tmux -V | grep -q -e '\\<1\\.' -e '\\<2\\.0'" \ |
|
'source ~/.tmux/mode-mouse-1.9-2.0.conf' \ |
|
'source ~/.tmux/mode-mouse-2.1.conf' |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
if-shell "tmux -V | grep -q -e '\\<1\\.' -e '\\<2\\.[0-5]'" \ |
|
'source ~/.tmux/vi-copy-mode-pre-2.6.conf' \ |
|
'source ~/.tmux/vi-copy-mode-2.6.conf' |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
if-shell "tmux -V | grep -q -e '\\<1\\.9' -e '\\<[2-9]\\.'" \ |
|
'source ~/.tmux/current-path-1.9+.conf' |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
if-shell "tmux -V | grep -q -e '\\<1\\.' -e '\\<2\\.[0-8]'" \ |
|
'source ~/.tmux/style-before-2.9.conf' |
|
|
|
if-shell "tmux -V | grep -q -e '\\<2\\.9' -e '\\<3\\.'" \ |
|
'source ~/.tmux/style-after-2.9.conf' |
|
|
|
# ------------------------------------------------------------------------ |
|
|
|
source ~/.tmux/scripts/fit.conf |