Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My ugly tmux config, much copied from others and tweaked
# tmux config for ultimate winning
# make tmux display things in 256 colors
#set -g default-terminal "screen-256color"
# use this if italic enabled in term profile
set -g default-terminal "tmux-256color"
# set just true color without custom term
#set -ga terminal-overrides ",xterm-256color:Tc"
# fixes bug: https://github.com/tmux/tmux/issues/435
#set -ga terminal-overrides ',xterm*:sitm=\E[3m'
# use this to have true color and italic
set -ga terminal-overrides ',xterm*:sitm=\E[3m:Tc'
# set scrollback history to 10000 (10k)
set -g history-limit 10000
# shorten command delay
set -sg escape-time 1
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
# reload ~/.tmux.conf using PREFIX r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h
bind - split-window -v
# Make the current window the first window
bind T swap-window -t 1
# map Vi movement keys as pane movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# and use C-h and C-l to cycle thru panes
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes using PREFIX H, J, K, L
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# --------------------
# Mouse
# -------------------
# changed in tmux 2.1
set -g mouse on
#bind-key -n WheelUpPane \
#if-shell -Ft= "#{?pane_in_mode,1,#{mouse_button_flag}}" \
#"send-keys -Mt=; send-keys -Mt=; send-keys -Mt=" \
#"if-shell -Ft= '#{alternate_on}' \
#'send-keys -t= Up Up Up' \
#'copy-mode -et='"
#bind-key -n WheelDownPane \
#if-shell -Ft= "#{?pane_in_mode,1,#{mouse_button_flag,1,#{?alternate_on,0,1}}}" \
#"send-keys -Mt=; send-keys -Mt=; send-keys -Mt=" \
#"send-keys -t= Down Down Down"
#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
#bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
#bind -t vi-copy C-WheelUpPane halfpage-up
#bind -t vi-copy C-WheelDownPane halfpage-down
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -t vi-copy WheelUpPane scroll-up
bind-key -t vi-copy WheelDownPane scroll-down
# ---------------------
# Copy & Paste on Mac
# ---------------------
# provide access to the clipboard for pbpaste, pbcopy on mac
#set-option -g default-command "reattach-to-user-namespace -l zsh"
# don't like it renaming my names
set-window-option -g automatic-rename off
# use vim keybindings in copy mode
setw -g mode-keys vi
# 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"
bind-key -t vi-copy y copy-pipe "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"
bind-key -t vi-copy Enter copy-pipe "pbcopy"
# use vim's yank to put in system clipboard
#bind y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
#bind C-y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
bind y run 'tmux save-buffer - | pbcopy '
bind C-y run 'tmux save-buffer - | pbcopy '
# ----------------------
# set some pretty colors. turned off since i'm using base16
# ----------------------
# set pane colors - hilight the active pane
#set-option -g pane-border-fg colour235 #base02
#set-option -g pane-active-border-fg colour240 #base01
# colorize messages in the command line
#set-option -g message-bg black #base02
#set-option -g message-fg brightred #orange
# set pane background color
#set-window-option -g window-style 'bg=#181818'
#set-window-option -g window-active-style 'bg=black'
# set-window-option -g pane-active-border-style ''
# -----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
set -g status-interval 5 # set update frequencey (default 15 seconds)
set -g status-justify centre # center window list for clarity
set-option -g status-position top # position the status bar at top of screen
# visual notification of activity in other windows
setw -g monitor-activity off
set -g visual-activity off
# set color for status bar
#set-option -g status-bg colour235 #base02
#set-option -g status-fg yellow #yellow
#set-option -g status-attr dim
# set window list colors - red for active and cyan for inactive
#set-window-option -g window-status-fg yellow #brightblue #base0
#set-window-option -g window-status-bg colour235 #colour236
#set-window-option -g window-status-attr dim
#set-window-option -g window-status-current-fg brightred #orange
#set-window-option -g window-status-current-bg colour236
#set-window-option -g window-status-current-attr bright
# show host name and IP address on left side of status bar
#set -g status-left-length 70
#set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
#set -g status-left "#h : #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}')"
# show session name, window & pane number, date and time on right side of
# status bar
#set -g status-right-length 60
# set -g status-right "#[fg=blue]#S #I:#P #[fg=yellow]:: %d %b %Y #[fg=green]:: %l:%M %p :: #(date -u | awk '{print $4}')::"
set -g status-right "%d %b %Y :: %l:%M %p "
#------------------------------------
# thiss tmux statusbar config was created based on gruvbox colorscheme
set -g status "on"
set -g status-justify "left"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-right-attr "none"
set -g status-attr "none"
set -g status-left-attr "none"
set -g pane-active-border-fg "colour248"
set -g pane-border-fg "colour238"
set -g status-bg "colour237"
set -g message-fg "colour237"
set -g message-bg "colour248"
set -g message-command-fg "colour237"
set -g message-command-bg "colour248"
setw -g window-status-fg "colour237"
setw -g window-status-bg "colour214"
setw -g window-status-attr "none"
setw -g window-status-activity-bg "colour237"
setw -g window-status-activity-attr "none"
setw -g window-status-activity-fg "colour248"
setw -g window-status-separator ""
set -g status-left "#[fg=colour248,bg=colour241] #S #[fg=colour241,bg=colour237,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour239,bg=colour237,nobold,nounderscore,noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248,bg=colour239,nobold,nounderscore,noitalics]#[fg=colour237,bg=colour248] #h "
setw -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223,bg=colour239] #W #[fg=colour239,bg=colour237,noitalics]"
setw -g window-status-current-format "#[fg=colour239,bg=colour248,:nobold,nounderscore,noitalics]#[fg=colour239,bg=colour214] #I #[fg=colour239,bg=colour214,bold] #W #[fg=colour214,bg=colour237,nobold,nounderscore,noitalics]"
#----------------------------------
# -----------------------
# tmux plugins
# -----------------------
# 1. add plugin to list below
# 2. refresh config with ctrl-b r
# 3. install new plugin with ctrl-b I
##############
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin 'tmux-plugins/tmux-sensible'
# loves to resurrect thyself
#set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @resurrect-capture-pane-contents 'on'
#set -g @resurrect-strategy-vim 'session'
# 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
You can’t perform that action at this time.