cloudcalvin
11/2/2016 - 11:52 AM

My tmux config

My tmux config

set -g history-limit 5000
set-window-option -g utf8 on # utf8 support

# Open man page in new window
bind / command-prompt "split-window 'exec man %%'"
bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard" 
set -g update-environment -r

# quick view of processes
bind '~' split-window "exec htop"

# titles
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T'

# default statusbar colors
set -g status-fg white
set -g status-bg black
set -g status-attr bright

# default window title colors
set-window-option -g window-status-fg white
set-window-option -g window-status-bg black
set-window-option -g window-status-attr dim

# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-attr bright

# 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

# Allows for faster key repetition
set -s escape-time 0

# 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

# 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

# Highlight active window
set-window-option -g window-status-current-bg red

# Vi copypaste mode
setw -g mode-keys vi
set-option -g status-keys vi
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

# move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(/usr/bin/xclip -sel clip -o)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind C-y run "tmux show-buffer | /usr/bin/xclip -sel clip -i"

# Mouse selects panes
set-option -g mouse-select-pane 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 -n C-Left select-pane -L
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
bind -n C-Right select-pane -R

# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."

# auto window rename
set-window-option -g automatic-rename

# rm mouse mode fail
set -g mode-mouse off

# color
set -g default-terminal "screen-256color"

# url view
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; run-shell "$TERMINAL -e 'cat /tmp/tmux-buffer | urlview'"

# Powerline
set-option -g default-shell /bin/zsh
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/tmux-powerline/powerline.sh right)"