Skip to content

Instantly share code, notes, and snippets.

@julie-is-late
Last active March 22, 2021 18:30
Show Gist options
  • Save julie-is-late/295f61cc6fe76698050d2a5045e50980 to your computer and use it in GitHub Desktop.
Save julie-is-late/295f61cc6fe76698050d2a5045e50980 to your computer and use it in GitHub Desktop.
current .tmux.conf, with glorious truecolor! 🌈
# jshap's tmux config
### keybindings
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# f!@# emacs
set-window-option -g xterm-keys on
# I am a mouse pleb
set-option -g mouse on
# set it so i can use 'tmux a' all the time (disabled because it breaks things with config reloading)
# new-session
# split panes using | and -
bind | split-window -h
bind \ split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file
bind r source-file ~/.tmux.conf
# history
set-option -g history-limit 50000
# don't auto rename windows
#set-window-option -g automatic-rename off
# do auto renumber windows
set-option -g renumber-windows on
# ctrl+left/right cycles thru windows
bind-key -n S-C-right next
bind-key -n S-C-left prev
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# enable good pasting from vi selection
bind -T copy-mode-vi MouseDown1Pane select-pane \;\
send-keys -X copy-pipe "pbcopy" \;\
send-keys -X clear-selection
# mouse selection shouldn't jump to beginning
unbind -T copy-mode-vi MouseDragEnd1Pane
# remove giberish from copy mode
set-option -s set-clipboard off
bind p paste-buffer
bind C-p choose-buffer
# 0 is too far from 1 ;)
set -g base-index 1
setw -g pane-base-index 1
# aggressively resize to the maximum available when using a `grouped session'
setw -g aggressive-resize on
# listen for activity on all windows
#set -g bell-action any
set -g bell-action current
# focus events enabled for terminals that support them
set -g focus-events on
# fun nested stuff (that I haven't fully figured out how I want to configure yet)
# TODO: make colors varaibles instead of magic #'s
bind -n M-F11 \
set -qg window-status-current-bg colour237 \; \
unbind C-a \; \
set-option -g prefix C-b
bind -n M-F12 \
set -qg window-status-current-bg colour241 \; \
unbind C-b \; \
set-option -g prefix C-a
bind C-S-up \
send-keys M-F12 \; \
set -g window-status-current-bg colour237 \; \
unbind -n C-S-right \; \
unbind -n C-S-left \; \
set-option -g prefix C-b
bind C-S-down \
send-keys M-F11 \; \
set -g window-status-current-bg colour241 \; \
bind -n C-S-right next \; \
bind -n C-S-left prev \; \
set-option -g prefix C-a
### color combatibility
# autodetect 256 color support
# (remember that $TERM is overridden to `screen' here and isn't the "owner" terminal's val once inside tmux's proc)
if-shell 'test $(tput colors) -ge 256' \
'set -g default-terminal "tmux-256color"' \
'set-option -g default-terminal tmux'
# terminal overrides, because I'm smarter than ncurses
# truecolor! (in normal and nested sessions)
set -ga terminal-overrides ",xterm-256color:Tc,tmux-256color:Tc"
# italics!
set -ga terminal-overrides ',xterm*:sitm=\E[3m'
# cursor shape?
set -ga terminal-overrides ',tmux*:Ss=\E[%p1%d q:Se=\E[2 q'
######################
### DESIGN CHANGES ###
######################
## Status bar design
# status line
# NOTE: unset this for tmux > 2.3
#set -g status-utf8 on
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2
# window status
# Info on left (I don't have a session display for now)
set -g status-left ''
# The modes {
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238
# }
# The panes {
set -g pane-border-bg colour235
set -g pane-border-fg colour238
#set -g pane-active-border-bg colour236
set -g pane-active-border-bg colour235
set -g pane-active-border-fg colour51
# }
# The statusbar {
set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour244] %H:%M '
if '! [ -z "$SSH_TTY" ]' 'set -g status-right "#[fg=colour123,bg=colour241] #h #[fg=colour233,bg=colour244] %H:%M "'
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-fg colour81
#setw -g window-status-current-bg colour238
setw -g window-status-current-bg colour241
setw -g window-status-current-attr none
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#{=10:window_name}#[fg=colour50]#F '
setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour244]:#[fg=colour250]#{=10:window_name}#[fg=colour244]#F '
setw -g window-status-bell-attr italics
setw -g window-status-bell-fg colour183
#setw -g window-status-bell-bg colour210
### tpm stuff
set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# tmux-resurrect contents
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'ssh weechat htop'
# issue with not being able to chsh in wsl on 1607 (rs1)
if-shell '[[ grep -iq "microsoft" /proc/sys/kernel/osrelease ]]' 'set -g default-command "/usr/bin/zsh"'
# start tpm
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment