Skip to content

Instantly share code, notes, and snippets.

@vazexqi
Created February 20, 2013 06:35
Show Gist options
  • Save vazexqi/4993432 to your computer and use it in GitHub Desktop.
Save vazexqi/4993432 to your computer and use it in GitHub Desktop.
My .tmux.conf file.
# .tmux.conf file inspired from Pragmatic Tmux
# http://pragprog.com/book/bhtmux/tmux
# Default to zsh with support for Mac OS X clipboard
set -g default-command "reattach-to-user-namespace -l /bin/zsh"
# https://wiki.archlinux.org/index.php/Tmux
# Set more scrollback history
# START:scrollback
set -g history-limit 10000
# END:scrollback
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
# END:unbind
#setting the delay between prefix and command
# START:delay
set -sg escape-time 1
# END:delay
# Ensure that we can send Ctrl-A to other apps
# http://mutelight.org/articles/practical-tmux
# START:bind_prefix
bind C-a send-prefix
# END:bind_prefix
# Set the base index for windows to 1 instead of 0
# START:index
set -g base-index 1
# END:index
# Set the base index for panes to 1 instead of 0
# START:panes_index
setw -g pane-base-index 1
# END:panes_index
# Reload the file with Prefix r
# START:reload
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# END:reload
# splitting panes
# START:panesplit
bind v split-window -h
bind s split-window -v
# END:panesplit
# moving between panes
# START:paneselect
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# END:paneselect
# Quick pane selection
# START:panetoggle
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# END:panetoggle
# Pane resizing
# START:paneresize
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# END:paneresize
# mouse support - set to on if you want to use the mouse
# START:mouse
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
# END:mouse
# Set the default terminal mode to 256color mode
# START:termcolor
set -g default-terminal "screen-256color"
# END:termcolor
# enable activity alerts
#START:activity
setw -g monitor-activity on
set -g visual-activity on
#END:activity
# set the status line's colors
# START:statuscolor
set -g status-fg white
set -g status-bg black
# END:statuscolor
# set the color of the window list
# START:windowstatuscolor
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
# END:windowstatuscolor
# set colors for the active window
# START:activewindowstatuscolor
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
# END:activewindowstatuscolor
# pane colors
# START:panecolors
# https://github.com/sjl/dotfiles/blob/master/tmux/tmux.conf
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
# END:panecolors
# Command / message line
# START:cmdlinecolors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# END:cmdlinecolors
# Status line
# START:statusline
# http://www.drbunsen.org/text-triumvirate.html
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=colour25,bg=colour39,noreverse,bold] #I ⮁ #W #[fg=colour39,bg=colour234,nobold]⮀"
# END:statusline
#START:utf8
set -g status-utf8 on
#END:utf8
# Update the status bar every sixty seconds
# START:updateinterval
set -g status-interval 60
# END:updateinterval
# enable vi keys.
# START:vikeys
setw -g mode-keys vi
# http://blog.sanctum.geek.nz/vi-mode-in-tmux/
# https://github.com/sjl/dotfiles/blob/master/tmux/tmux.conf
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
# END:vikeys
# Maximize and restore a pane
# START:max
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
# END:max
# START:restore
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# END:restore
# Log output to a text file on demand
# START:pipe-pane
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# END:pipe-pane
# Clear and reset terminal
# START: clear
# http://stackoverflow.com/questions/10543684/how-can-i-clear-scrollback-buffer-in-tmux
bind-key C send-keys "clear && tmux clear-history" \; send-keys "Enter"
# END: clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment