Skip to content

Instantly share code, notes, and snippets.

@will118
Created January 19, 2016 10:09
Show Gist options
  • Save will118/a38bbbd309cb64a5c847 to your computer and use it in GitHub Desktop.
Save will118/a38bbbd309cb64a5c847 to your computer and use it in GitHub Desktop.
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# vi is good
setw -g mode-keys vi
# mouse behavior
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
set-option -g default-terminal screen-256color
bind-key : command-prompt
bind-key r refresh-client
bind-key L clear-history
bind-key space next-window
bind-key bspace previous-window
bind-key enter next-layout
# use vim-like keys for splits and windows
bind-key v split-window -h
bind-key s split-window -v
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key C-o rotate-window
bind-key + select-layout main-horizontal
bind-key = select-layout main-vertical
set-window-option -g other-pane-height 25
set-window-option -g other-pane-width 80
bind-key a last-pane
bind-key q display-panes
bind-key c new-window
bind-key t next-window
bind-key T previous-window
bind-key [ copy-mode
bind-key ] paste-buffer
# Resizing splits
bind-key -n C-S-Up resize-pane -U 10
bind-key -n C-S-Down resize-pane -D 10
bind-key -n C-S-Left resize-pane -L 10
bind-key -n C-S-Right resize-pane -R 10
# 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"
set-option -g status on # turn the status bar on
set -g status-utf8 on # set utf-8 for the status bar
set -g status-interval 5 # set update frequencey (default 15 seconds)
set -g status-justify left # center window list for clarity
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# set color for status bar
set-option -g status-bg black #base02
set-option -g status-fg yellow #yellow
set-option -g status-attr dim
# default window title colors
set-window-option -g window-status-fg brightblue #base0
set-option -g pane-border-fg colour59
set-option -g pane-active-border-fg colour61
set -g status-right-length 0
#--------------------------------------------
#(shell-command) First line of the command's output
#[attributes] Colour or attribute change
#H Hostname
#F window flag
#I Current window index
#P Current pane index
#S Session name
#T title
#W window name
## A literal "#"
set-option -g set-titles on
set -g set-titles-string '#W'
set -g status-left '#[fg=colour254,bg=colour234,nobold]'
set -g status-fg black
set -g status-bg colour236
set -g window-status-format "#[fg=colour241,bg=colour236] #I #[fg=colour238,bold]#W #[fg=colour31,bg=colour235,nobold]"
set -g window-status-current-format "#[fg=colour117,bg=colour236] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour236,nobold]"
set -g window-status-separator " "
set -s escape-time 0
set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
set-option -g repeat-time 0
set-option -g renumber-windows on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment