Skip to content

Instantly share code, notes, and snippets.

@srathbun
Created July 16, 2014 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srathbun/06f7c3c4def4cc48077a to your computer and use it in GitHub Desktop.
Save srathbun/06f7c3c4def4cc48077a to your computer and use it in GitHub Desktop.
My tmux config
set-option -g default-command "reattach-to-user-namespace -l zsh"
# fix colors
set -g default-terminal "screen-256color"
# Arrow movement: nice
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-S-left swap-pane -D
bind -n C-S-right swap-pane -U
bind -r [ swap-window -t -1
bind -r ] swap-window -t +1
bind r source-file ~/.tmux.conf \; display-message " Config reloaded."
bind R source-file ~/.tmux.conf \; display-message " Config reloaded."
# All sutff for a status bar
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
# Highlight active window
set-window-option -g window-status-current-bg red
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=green]#H"
# Fix window size on new connections
set -g aggressive-resize on
# resize
unbind Left
unbind Right
unbind Down
unbind Up
bind -r Left resize-pane -L 2
bind -r Right resize-pane -R 2
bind -r Down resize-pane -D 2
bind -r Up resize-pane -U 2
# Toggle mouse on with ^B m
# Useful for cut/paste interop
bind m \
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
set -g mode-mouse on \;\
display 'Mouse: ON'
bind C-v paste-buffer
# Toggle mouse off with ^B M
bind M \
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
set -g mode-mouse off \;\
display 'Mouse: OFF'
set-window-option -g mode-keys vi
unbind T
unbind N
bind -r T clock-mode
bind -r N next-window
# I use ^b^A to switch panes quickly
unbind ^A
bind ^A select-pane -t :.+
# Fix scrolling?
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g history-limit 10000
# Clear terminal scrollback on ^k
# conflicts with vim binding
# bind -n C-k send-keys -R \; clear-history
# Easy splits
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
# Nested tmux support
bind-key b send-prefix
# Multiple server support
bind s set -g synchronize-panes
# Move panes between windows (seems to be slightly broke)
bind-key B break-pane
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key S command-prompt -p "send pane to:" "join-pane -t '%%'"
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -t vi-copy 'd' cursor-left
bind-key -t vi-copy 'h' cursor-down
bind-key -t vi-copy 't' cursor-up
bind-key -t vi-copy 'n' cursor-right
bind-key -t vi-copy 'l' search-again
bind k kill-window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment