Skip to content

Instantly share code, notes, and snippets.

@jpstokes
Created October 3, 2017 11:57
Show Gist options
  • Save jpstokes/c953c1dfa11e1ff813bf00be5974d88e to your computer and use it in GitHub Desktop.
Save jpstokes/c953c1dfa11e1ff813bf00be5974d88e to your computer and use it in GitHub Desktop.
tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# set-option -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-window-option -g pane-base-index 1
set-option -g set-titles on
# enable mouse to select window
set-option -g mouse on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
setw -g mode-keys vi
# setw -g mode-mouse on
setw -g monitor-activity on
bind-key v split-window -h
bind-key s split-window -v
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R
bind-key C-L choose-session
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(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"
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Shift arrow to switch windows
bind -n S-Down choose-session
bind -n S-Up choose-session
# No delay for escape key press
set -sg escape-time 0
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Reload tmux config
bind r source-file ~/.tmux.conf
### Theme
###########################################################################
# Statusbar Color Palatte
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-interval 4
set-option -g status-left-length 100
set-option -g status-right-length 100
# Pane Border Color Palette
set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black
# Message Color Palette
set-option -g message-fg black
set-option -g message-bg green
# Window Status Color Palette
setw -g window-status-bg black
setw -g window-status-current-fg green
setw -g window-status-bell-attr default
setw -g window-status-bell-fg red
setw -g window-status-activity-attr default
setw -g window-status-activity-fg yellow
### UI
###########################################################################
# Notification
setw -g monitor-activity on
set -g visual-activity on
set-option -g bell-action any
set-option -g visual-bell off
# Automatically set window titles
set-option -g set-titles on
set-option -g set-titles-string '#[fg=cyan]#H:#S.#I.#P #W #T' # window number,program name,active (or not)
# Statusbar Adjustments
set -g status-left "#[fg=red]#(whoami):#[fg=white]#S#[fg=green] | #[fg=cyan]#(git rev-parse --abbrev-ref HEAD) #[fg=green]| #[fg=red][ #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}')#[fg=red]#(ifconfig utun0 | grep 'inet ' | awk '{print \"\| vpn \" $2}')| #[fg=yellow]#{proxy_status} #[fg=red]] #[fg=green]| "
# Show performance counters in statusbar
# Requires https://github.com/thewtex/tmux-mem-cpu-load/
set -g status-right "Batt: #{battery_icon} #{battery_percentage} #{battery_remain} #[fg=green] | #[fg=yellow]#(tmux-mem-cpu-load)#[fg=green] | #[fg=cyan]%a, %b %d %Y - %r #[default]"
run-shell ~/.tmux/tmux-proxy/proxy.tmux
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-proxy'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment