Skip to content

Instantly share code, notes, and snippets.

@jbaxleyiii
Created July 20, 2017 19:44
Show Gist options
  • Save jbaxleyiii/21bd773482d503f8b044323a8a634c5a to your computer and use it in GitHub Desktop.
Save jbaxleyiii/21bd773482d503f8b044323a8a634c5a to your computer and use it in GitHub Desktop.
# rebind prefix key
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind R source-file /home/jbaxleyiii/.tmux.conf \; display-message "tmux.conf reloaded"
set -g default-terminal "xterm-256color"
# mouse
set-option -g mouse on
unbind-key -n WheelUpStatus
unbind-key -n WheelDownStatus
# use vim like keys for splits and windows
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# 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-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 + select-layout main-horizontal
bind-key = select-layout main-vertical
# shortcuts
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
# setup 'v' to being 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"
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# allow vim to receive modifier keys
set-window-option -g xterm-keys on
# horizontal and vertical splits
unbind |
bind | split-window -h
unbind _
bind _ split-window
# resize pane
bind-key -r Left resize-pane -L 5
bind-key -r Up resize-pane -U 5
bind-key -r Down resize-pane -D 5
bind-key -r Right resize-pane -R 5
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# switch to last pane
bind-key C-a last-pane
bind-key s set-window-option synchronize-panes
#----------------------
# set some pretty colors
# ----------------------
# set pane colors - hilight the active pane
set-option -g pane-border-fg colour233 #base02
set-option -g pane-active-border-fg colour240 #base01
set -g pane-border-fg colour242
set -g pane-active-border-fg colour237
set -g pane-active-border-bg colour233
# colorize messages in the command line
set-option -g message-bg black #base02
set-option -g message-fg brightred #orange
# ----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
# 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 colour233
set-option -g status-fg colour0
set-option -g status-attr dim
# set window list colors
set-window-option -g window-status-fg colour233
set-window-option -g window-status-bg colour233
set-window-option -g window-status-current-fg colour242
set-window-option -g window-status-current-bg colour233
# status bar
set -g status-left-length 0
set -g status-right-length 60
set -g status-right "#[fg=brightred]%l:%M%p #(pmset -g batt | battery)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment