Skip to content

Instantly share code, notes, and snippets.

@saelo
Last active September 17, 2015 10:00
Show Gist options
  • Save saelo/85a08a96e61d43d1bf73 to your computer and use it in GitHub Desktop.
Save saelo/85a08a96e61d43d1bf73 to your computer and use it in GitHub Desktop.
tmux configuration
#
# ~~~~~ Prefix ~~~~~
#
# change prefix to ctrl-a
set -g prefix C-a
bind C-a send-prefix
bind a send-prefix
unbind C-b
#
# ~~~~~ Navigation ~~~~~
#
# mouse works as expected
setw -g mode-mouse on
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#set -g mouse-select-window on
# enable vim like navigation
set -g mode-keys vi
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes with vim movement keys
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
# quick pane cycling (ctrl-a-a)
unbind ^A
bind ^A select-pane -t :.+
# smart pane switching with awareness of vim splits
# this only works in combination with the 'christoomey/vim-tmux-navigator' vim plugin
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
#
# ~~~~~ Copy mode settings ~~~~~
#
# For linux, change "pbcopy" to "xclip -in -selection clipboard" (I believe)
# setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "pbcopy"
# update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "pbcopy"
#
# ~~~~~ Window/Pane control settings ~~~~~
#
# easy-to-remember split pane commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# I use resize a lot, so I make it accessible faster
bind -n C-f resize-pane -Z
#
# ~~~~~ Miscellaneous settings ~~~~~
#
# notify on activity in different window
setw -g monitor-activity on
#set -g visual-activity on
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
# larger history
set -g history-limit 1000000
# limit amount of text printed to console at any time
# this prevents tmux from freezing when programs inside tmux print lots of output
setw -g c0-change-trigger 10
setw -g c0-change-interval 250
#
# ~~~~~ Colorscheme (Solarized 256) ~~~~~
#
# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright
# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01
# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment