Skip to content

Instantly share code, notes, and snippets.

@svnlto
Created April 5, 2017 16:41
Show Gist options
  • Save svnlto/8f4e83a097f3945bd1cdb3230171c69e to your computer and use it in GitHub Desktop.
Save svnlto/8f4e83a097f3945bd1cdb3230171c69e to your computer and use it in GitHub Desktop.
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -g default-terminal "screen-256color"
# start windows and panes at 1
set -g base-index 1
set -g pane-base-index 1
# use vi mode
setw -g mode-keys vi
# don't detach tmux when killing a session
set -g detach-on-destroy off
# focus events enabled for terminals that support them
set -g focus-events on
# 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"
# don't wait for an escape sequence after hitting
# Esc. fixes insert mode exit lag in vim
set -sg escape-time 0
# increase scrollback buffer size
set -g history-limit 50000
# Status bar refresh rate (seconds)
set -g status-interval 60
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# quick pane cycling with Ctrl-a
unbind ^A
bind ^A select-pane -t :.+
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
# resize panes
unbind Right
bind Right resize-pane -R 8
#unbind Left
bind Left resize-pane -L 8
#unbind Up
bind Up resize-pane -U 4
#unbind Down
bind Down resize-pane -D 4
# Use prefix C-l to clear the visible scrollback lines
bind C-l send-keys 'C-l'
# colour
battery_color=colour8
date_color=colour7
left_section_color1=colour0
left_section_color2=colour8
time_color=colour255
tm_color_active=colour39
tm_color_inactive=colour241
tm_color_feature=colour198
tm_color_music=colour198
tm_active_border_color=colour39
# separators
tm_separator_left_bold="◀"
tm_left_separator_black=''
tm_right_separator_black=''
tm_separator_left_thin="❮"
tm_separator_right_bold="▶"
tm_separator_right_thin="❯"
# status bar
set -g status-right-length 60
# default statusbar colors
set-option -g status-fg $tm_color_active
set-option -g status-bg colour0
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg $tm_color_inactive
set-window-option -g window-status-bg colour0
set -g window-status-format "#I #W"
# active window title colors
set-window-option -g window-status-current-fg $tm_color_active
set-window-option -g window-status-current-bg colour0
set-window-option -g window-status-current-format "#[bold]#I #W"
# pane border
set-option -g pane-border-fg $tm_active_border_color
set-option -g pane-active-border-fg $tm_active_border_color
# message text
set-option -g message-bg default
set-option -g message-fg $tm_color_active
# pane number display
set-option -g display-panes-active-colour $tm_color_active
set-option -g display-panes-colour $tm_color_inactive
# clock
set-window-option -g clock-mode-colour $tm_color_active
tm_date="#[fg=$time_color] %R #[fg=$date_color]%d %b"
tm_host="#[fg=$tm_color_feature,bold]#h"
set -g status-left $status_left
mah_separator1="#[fg=colour0]$tm_right_separator_black#[bg=$left_section_color1]"
mah_separator2="#[fg=$left_section_color2]$tm_right_separator_black#[bg=$left_section_color2]"
status_right=$mah_separator1' '$tm_tunes' '$mah_separator2' '$tm_date' '
set -g status-right $status_right
# New window with default path set to last path
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment