Skip to content

Instantly share code, notes, and snippets.

@ashrithr
Last active December 17, 2015 16:19
Show Gist options
  • Save ashrithr/5637840 to your computer and use it in GitHub Desktop.
Save ashrithr/5637840 to your computer and use it in GitHub Desktop.
tmux configuration
# set command prefix for tmux as ctrl-a instead of ctrl-b
set-option -g prefix C-a
unbind C-a
# To use regular Ctrl-a to move cursor to beginning of line use Ctrl-a Ctrl-a
unbind-key C-b
bind-key C-a send-prefix
# set vi mode keys
setw -g mode-keys vi
# set some bindings for moving around terminals (vim-like)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#
# Define my custom menu bar
#
# # status bar colors
# set -g status-bg black
# set -g status-fg white
# # alignment settings
# set-option -g status-justify centre
# # status left options
# set-option -g status-left '#[fg=green][#[bg=black,fg=cyan]#S#[fg=green]]'
# set-option -g status-left-length 20
# # window list options
# setw -g automatic-rename on
# set-window-option -g window-status-format '#[fg=cyan,dim]#I#[fg=blue]:#[default]#W#[fg=grey,dim]#F'
# set-window-option -g window-status-current-format '#[bg=blue,fg=cyan,bold]#I#[bg=blue,fg=cyan]:#[fg=colour230]#W#[fg=dim]#F'
# set -g base-index 1
# # status right options
# set -g status-right '#[fg=green][#[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default] #($HOME/bin/battery)#[fg=green]]'
# color scheme (style based on vim-powerline)
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 colour46
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]⮀"
# bind a reload key
bind R source-file ~/.tmux.conf \; display-message " Config reloaded..".
# buffer
bind Space choose-buffer
#pane split bindings
unbind % #remove default binding since we're replacing
bind | split-window -h
bind - split-window -v
#mouse scrolling on
setw -g mode-mouse on
#allow mouse to select which pane to use
set -g mouse-select-pane on
# scroll history
set -g history-limit 1000000
# scrolling with terminal scroll bar
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# set active pane border
set-option -g pane-active-border-fg blue
# Toggle mouse on with ^A m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with ^A M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
#
# Set Copy-Mode settings
# This requires: brew install reattach-to-user-namespace
#
# Using:
# 1. <prefix> [ to start “copy-mode”
# 2. Move to the text you want to copy using Vim-like key bindings, i.e., k to move up a line, / to search, etc
# 3. v to start selection
# 4. Move to end of text with Vim key-bindings. The selection will be highlighted
# 5. y to copy the highlighted/selected text
#
# Setup 'v' to begin selection as in Vim
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment