Skip to content

Instantly share code, notes, and snippets.

@joelremix
Created December 5, 2021 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelremix/b09dc9559aad2af0a6f7783fa7aeeb78 to your computer and use it in GitHub Desktop.
Save joelremix/b09dc9559aad2af0a6f7783fa7aeeb78 to your computer and use it in GitHub Desktop.
tmux.conf
# set -g default-terminal "screen-256color"
# set -g default-terminal "screen.xterm-256color"
# set -g default-terminal "tmux-256color"
set -g default-terminal "screen"
# set -g default-terminal "xterm"
set-option -gw mode-keys vi # vi style key bindings
bind-key -n C-k clear-history
# Source config
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Edit config
bind-key M split-window -h "vim ~/.tmux.conf"
# unbind-key C-b
set-option -g prefix C-Space
# set-option -g prefix C-a
# Bindings:
# - to see current bindings:
# list-keys -t {vi,emacs}-{edit,choice,copy}
# Open new/split panes with the path of the current pane.
# unbind %
# bind % split-window -h -c '#{pane_current_path}'
# unbind '"'
# bind '"' split-window -v -c '#{pane_current_path}'
# Vim-like key bindings for pane navigation (default uses cursor keys).
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l # normally used for last-window
bind l select-pane -R
# Resizing (mouse also works).
unbind Left
bind -r Left resize-pane -L 5
unbind Right
bind -r Right resize-pane -R 5
unbind Down
bind -r Down resize-pane -D 5
unbind Up
bind -r Up resize-pane -U 5
# Fast toggle (normally prefix-l).
# bind ^space last-window
unbind space
# bind space last-window
# Intuitive window-splitting keys.
unbind c
bind c new-window -c '#{pane_current_path}'
unbind %
bind | split-window -h -c '#{pane_current_path}' # normally prefix-%
unbind '"'
bind '\' split-window -v -c '#{pane_current_path}' # normally prefix-%
# --------------------
# Status Bar
# --------------------
set-option -g status-position top
# set-option -g status-bg #444444
# set-option -g status-fg #ffd787
# set -g status-bg '#343d46'
# set -g status-fg white
# set -g status-left-length 40
# set -g status-left '#[fg=yellow]#S ⧉ '
# set -g status-right "#[fg=yellow]$USER@#h #[fg=yellow]%l:%M %p"
# set -g status-interval 60 # Default is 15.
# set-option -g status-style 'bg=#373b41,fg=white,bold'
# set-option -g status-left-length 40
# set-option -g status-left '#[bg=yellow,fg=#373b41,bold] #S § ' # SECTION SIGN (UTF-8: c2 a7)
# set-option -g status-right "#[fg=yellow,bold]$USER@#h #[fg=yellow]%l:%M %p "
# set-option -g status-interval 60 # Default is 15.
set-option -g status-style 'bg=#222831,fg=#ececec,bold'
set-option -g status-left-length 40
set-option -g status-left '#[bg=#dfd3c3,fg=#373b41,bold] #S § ' # SECTION SIGN (UTF-8: c2 a7)
set-option -g status-right "#[fg=yellow,bold]$USER@#h #[fg=yellow]%l:%M %p "
set-option -g status-interval 60 # Default is 15.
# window title colors
set-window-option -g window-status-style fg=yellow
# active window title colors
set-window-option -g window-status-current-style bg=#596e79,fg=#ececec
# border colours
set -g pane-active-border-style bg=default,fg=magenta
set -g pane-border-style fg=green
#Alternatively, use double quotes to specify multiple: set -g pane-active-border-style "bg=default fg=magenta"
# Automatically renumber window numbers on closing a pane (tmux >= 1.7).
set -g renumber-windows on
# Highlight active window.
# set -w -g window-status-current-bg red
# set -g window-active-style 'fg=colour250,bg=black'
# Mouse can be used to select panes, select windows (by clicking on the status
# bar), resize panes. For default bindings see `tmux list-keys` and `tmux
# list-keys -t vi-copy`.
set -g mouse on
# Restore pre-2.1 behavior of scrolling with the scrollwheel in Vim, less, copy
# mode etc, otherwise entering copy mode if not already in it.
#
# if in copy mode (pane_in_mode) || using the mouse already (mouse_any_flag)
# pass through mouse events to current pane (send -Mt=)
# elsif in alternate screen mode
# send `Up` key
# else
# enter copy mode (-e exits if we scroll to the bottom)
# end
#
bind-key -T root WheelUpPane \
if-shell -Ft= '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -Ft= "#{alternate_on}" "send -t= Up" "copy-mode -et="'
bind-key -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -Ft= "#{alternate_on}" "send -t= Down" "send -Mt="'
# Stay in copy mode on drag end, but otherwise exit for mouse up.
# Requires patch from https://github.com/tmux/tmux/issues/326
# unbind-key -t vi-copy MouseDragEnd1Pane
# bind-key -t vi-copy MouseUp1Pane cancel
# For those times when C-c and q are not enough.
# bind-key -t vi-copy Escape cancel
# Slightly more useful width in "main-vertical" layout; enough room for 3-digit
# line number gutter in Vim + 80 columns of text + 1 column breathing room
# (default looks to be about 79).
set -w -g main-pane-width 85
# set -g default-terminal "tmux-256color"
# set -ga terminal-overrides ',xterm-256color:Tc'
set -g history-limit 262144
# Start window and pane numbering at 1, (0 is too hard to reach).
set -g base-index 1
set -g pane-base-index 1
# Don't wait for an escape sequence after seeing C-a.
set -s escape-time 0
# Dynamically update iTerm tab and window titles.
set -g set-titles on
# Needed as on tmux 1.9 and up (defaults to off).
# Added in tmux commit c7a121cfc0137c907b7bfb.
set -g focus-events on
# But don't change tmux's own window titles.
set -w -g automatic-rename off
# Don't wrap searches; it's super confusing given tmux's reverse-ordering of
# position info in copy mode.
set -w -g wrap-search off
# #T = standard window title (last command, see ~/.bash_profile)
# #h = short hostname
# #S = session name
# #W = tmux window name
#
# (Would love to include #(pwd) here as well, but that would only print the
# current working directory relative to the session -- ie. always the starting
# cwd -- which is not very interesting).
set -g set-titles-string "#T : #h > #S > #W"
# Show bells in window titles.
set -g window-status-bell-style fg=yellow,bold,underscore
# Clipper.
bind-key y run-shell "tmux save-buffer - | nc -U ~/.clipper.sock"
# "copy-pipe" requires tmux >= 1.8
# bind-key -t vi-copy Enter copy-pipe "nc -U ~/.clipper.sock"
# tpm {{{ #
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-yank'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'wfxr/tmux-fzf-url'
# Note: Change the plugin order carefully!
set -g @plugin 'wfxr/tmux-power'
set -g @tmux_power_theme 'gold'
# / / /
set -g @tmux_power_show_upload_speed false
set -g @tmux_power_show_download_speed false
# set -g @tmux_power_upload_speed_icon ''
set -g @tmux_power_upload_speed_icon ' '
set -g @tmux_power_download_speed_icon ' '
set -g @tmux_power_prefix_highlight_pos 'LR'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
set -g @plugin 'wfxr/tmux-net-speed'
if -b '"$(uname)" = Darwin' 'source-file ~/.tmux_osx.conf'
# Plugin Settings
set -g @resurrect-save-shell-history 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# }}} tpm #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment