Skip to content

Instantly share code, notes, and snippets.

@dphase
Created February 15, 2021 22:38
Show Gist options
  • Save dphase/27eef633b8f93c2d2cab62a676447d43 to your computer and use it in GitHub Desktop.
Save dphase/27eef633b8f93c2d2cab62a676447d43 to your computer and use it in GitHub Desktop.
# ╔═════════════════════════════════════╦═══════════════════════════════╗
# ║ _ ____ _ ║ _ ║─┐
# ║ __| | _ \| |__ __ _ ___ ___ ║ | |_ _ __ ___ _ ___ __ ║ │
# ║ / _` | |_) | '_ \ / _` / __|/ _ \ ║ | __| '_ ` _ \| | | \ \/ / ║ │
# ║ | (_| | __/| | | | (_| \__ \ __/ ║ | |_| | | | | | |_| |> < ║ │
# ║ \__,_|_| |_| |_|\__,_|___/\___| ║ \__|_| |_| |_|\__,_/_/\_\ ║ │
# ║ ║ ║ │
# ╚═════════════════════════════════════╩═══════════════════════════════╝ │
# └──────────────────────────────────────────────────────────────────────┘
# tap the os x clipboard
set-option -g default-command "reattach-to-user-namespace -l /usr/local/bin/zsh"
# basic global settings:
set-option -g status-keys vi
set-window-option -g mode-keys vi
set-window-option -g mouse on
set -g default-terminal tmux-256color
set-option -as terminal-overrides ",xterm*:Tc:sitm=x27[3m"
set-option -g history-limit 10000
set -s escape-time 0
setw -g aggressive-resize off
## keybinds - sort ofmimic GNU screen
unbind ^X
bind ^X lock-server
unbind ^C
bind ^C new-window
unbind c
bind c new-window
unbind ^D
bind ^D detach
unbind *
bind * list-clients
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window
# title A
unbind A
bind A command-prompt "rename-window %%"
unbind a
bind a command-prompt "rename-window %%"
# other ^A
unbind ^A
bind ^A last-window
# prev ^H ^P p ^?
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window
# windows ^W
unbind ^W
bind ^W list-windows
# kill K k
unbind K
bind K confirm-before "kill-window"
unbind k
bind k confirm-before "kill-window"
# redisplay ^L l
unbind ^L
bind ^L refresh-client
# logging
bind l pipe-pane \; display-message 'Ended logging to $HOME/#W-tmux.log'
# More straight forward key bindings for splitting
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind \\ split-window -h -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
unbind '"'
bind - split-window -v -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
# Pane
unbind s
bind s select-pane -D
unbind w
bind w select-pane -U
unbind z
bind z select-pane -L
unbind x
bind x select-pane -R
# break pane into own window
bind-key B break-pane
# pane movement
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key J command-prompt -p "send pane to:" "join-pane -t '%%'"
unbind ^k
bind-key ^k resize-pane -U
unbind ^j
bind-key ^j resize-pane
unbind ^l
bind-key ^l resize-pane -R
unbind ^h
bind-key ^h resize-pane -L
# swapping
bind-key W swap-pane -U
bind-key S swap-pane -D
# more pane movement, i bind these to cmd-[arrow] in iterm
bind-key Q select-pane -L
bind-key E select-pane -D
bind-key R select-pane -U
bind-key T select-pane -R
# sync panes
unbind ^s
bind-key ^s set-window-option synchronize-panes on \; display-message "Sync panes ON"
unbind ^S
bind-key ^S set-window-option synchronize-panes off \; display-message "Sync panes OFF"
# reload config
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
###
### Apperance
###
## window titles
# enable wm (e.g. fluxbox) window titles:
set-option -g set-titles on
set-option -g set-titles-string "tmux | #T (#I/#P)"
## cheats for customizing above
# H Host
# I Current window index
# P Current pane index
# S Session name
# T Current window title
# W Current window name
# # A literal #
## panes:
# active pane
set-option -g pane-active-border-style fg=colour240,bg=default
# inactive pane
set-option -g pane-border-style fg=colour240,bg=default
# clock-mode
set-window-option -g clock-mode-colour red
set-window-option -g clock-mode-style 24
# command/message line colors
set-option -g message-style bg=colour033,fg=colour255
# messages (tmux system messages)
set-window-option -g mode-style bg=colour028,fg=colour255
# default statusbar colors
set-option -g status-style fg=white,bg=colour235
# other statusbar configs:
set-option -g status-interval 5
# set-option -g status-utf8 on
set-option -g status-justify right
# active window title colors
set-window-option -g window-status-current-style fg=colour117,bg=colour235
set-window-option -g window-status-style bright
# inactive window title colors
set-window-option -g window-status-style fg=colour244,bg=colour235,dim
# window title formats
setw -g window-status-format "#[fg=colour239,bg=colour235] #I #[bg=colour235,fg=colour237]│#[fg=colour241] #W "
setw -g window-status-current-format "#[fg=colour157,bg=colour239] #I #[fg=colour212,bg=colour237] #W#[fg=colour157]#F "
# window title:
set-option -g set-titles on
# set-option -g set-titles-string 'jd'
setw -g automatic-rename on
# default is "on" for status bar
set-option -g status on
# center align window list
set-option -g status-justify left
# what is to be shown to the left on the status bar
# ░ ▒ ▓ █
set-option -g status-left-length 35
set-option -g status-left '#[bg=colour255,fg=colour097] × #[fg=colour255,bg=colour126]#[fg=colour255,bg=colour126] #(hostname | cut -d . -f 1 | cut -d '-' -f 1) #[fg=colour025,bg=colour038]#[fg=colour235,bg=colour126]▒#[bg=colour235] '
# what is to be shown to the right on the status bar
set-option -g status-right-length 60
set-option -g status-right '#[bg=colour236,fg=colour235]▒#[fg=colour237,bg=colour240]#[fg=colour255,bg=colour237] %a, %b %d #[bg=colour239,fg=colour241]▒#[fg=colour241,bg=colour246]#[fg=colour255,bg=colour241] %H:%M%p '
# lock entire session, and all clients (seconds)
# set-option -g lock-server on
# set-option -g lock-after-time 3600
# set-option -g lock-command 'cmatrix -b -u 9'
# copy mode crap
unbind [
bind-key Escape copy-mode
unbind [
bind-key P paste-buffer
bind -T copy-mode-vi v send-keys -X begin-selection
unbind y
# bind -t vi-copy Q copy-pipe 'pbcopy'
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# bind -t vi-copy y copy-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment