Skip to content

Instantly share code, notes, and snippets.

@medihack
Last active March 17, 2017 16:49
Show Gist options
  • Save medihack/8660237 to your computer and use it in GitHub Desktop.
Save medihack/8660237 to your computer and use it in GitHub Desktop.
For tmux version 1.x
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
setw -g xterm-keys on
# Fix colors tmux + vim
# alternatively start with: tmux -2
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm:colors=256'
# Start window numbering at 1
set -g base-index 1
# automatically renumber window numbers on closing a pane (tmux >= 1.7)
set -g renumber-windows on
# Allows for faster key repetition
set -s escape-time 0
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=yellow]Session:#S Host:#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
# increase history
set -g history-limit 262144
# rate-limiting (tmux >= 1.7)
set -g c0-change-trigger 50 # default is 250 triggers/millisecond
set -g c0-change-interval 1000 # default throttle updates at 100 ms intervals
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# Highlight active window
set-window-option -g window-status-current-bg red
# Search like in Vim
setw -g mode-keys vi
# increase repeate time (-r option) a bit
set -g repeat-time 800
# mouse can be used to select panes
set -g mouse-select-pane on
# mouse can be used to select windows (by clicking in the status bar)
set -g mouse-select-window on
# mouse can be used to resize panes (by dragging dividers)
set -g mouse-resize-pane on
# not really sure what this does, but with it, the scrollwheel works inside Vim
set -g mouse-utf8 on
# allow mouse to enter copy mode and initiate selection
set -w -g mode-mouse on
# Split a more like vim
unbind-key s
bind-key s split-window -v
unbind-key v
bind-key v split-window -h
# Resize panes in a similar way
unbind-key C-j
bind-key -r C-j resize-pane -D
unbind-key C-k
bind-key -r C-k resize-pane -U
unbind-key C-h
bind-key -r C-h resize-pane -L
unbind-key C-l
bind-key -r C-l resize-pane -R
# double prefix switch to next pane
unbind-key C-a
bind-key C-a last-pane
# Navigate panes like in Vim
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment