Skip to content

Instantly share code, notes, and snippets.

@shearluck
Last active October 19, 2019 04:18
Show Gist options
  • Save shearluck/b46d6460d5c424909e43 to your computer and use it in GitHub Desktop.
Save shearluck/b46d6460d5c424909e43 to your computer and use it in GitHub Desktop.
Tmux config
# S.R TMUX conf
# set = set option
# setw = set window option
# bind -r = allow recursive press after prefix
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'srathbone/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Enable true colours
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# Increase repeat-time
set -g repeat-time 2000
# Increase display-time
set -g display-time 2000
# Enable focus events
set -g focus-events on
# No automatic rename with zsh
set -g allow-rename off
set -g set-titles on
set -g set-titles-string "#T"
# scroll-back history
set -g history-limit 10000
# set delay
set -sg escape-time 0
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Renumber windows on close
set -g renumber-windows on
# Enable mouse support
set -g mouse on
# Refresh status bar every x seconds
set -g status-interval 5
# Set activity alert
setw -g monitor-activity on
set -g visual-activity on
# Plugins
## Online status
set -g @online_icon "#[fg=#73d216]✔"
set -g @offline_icon "#[fg=#fc4138]✘"
## Prefix indicator
set -g @prefix_highlight_bg "#5294e2"
set -g @prefix_highlight_fg "#ffffff bold"
# vim keys
setw -g mode-keys vi
# Change prefix
set -g prefix C-a
bind C-a send-prefix
unbind C-b
# Bindings
bind -n End send-key C-e
bind -n Home send-key C-a
bind a send-prefix
# Send keys to all panes in a window
bind o setw synchronize-panes
# Reload conf with prefix + r
bind r source-file ~/.tmux.conf\; display "Conf Reloaded."
# Logging shortcut
bind P pipe-pane -o "cat >>$HOME/tmux.log" \; display "Toggled logging to ~/tmux.log"
# x clipboard support
#bind-key -T copy-mode-vi y copy-pipe "xsel -i -p -b"
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy"
bind-key p run "xsel -o -b | tmux load-buffer - ; tmux paste-buffer"
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"
# splitting panes
bind | split-window -h -c "#{pane_current_path}"
bind \ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
# new window with current dir
bind c new-window -c "#{pane_current_path}"
# Maximize and minimize pane support
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# moving between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# moving between windows
bind -r C-h previous-window
bind -r C-l next-window
# Resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Theme
## Status
set -g status-left ""
### Fancy Font
set -g status-right "#{prefix_highlight} #[fg=#888888]#{pane_current_command}#[fg=#ffffff]  #S:#I.#P  #($HOME/.config/tmux/.config/tmux/uptime.sh)  #{online_status}#[fg=#ffffff]  #($HOME/.config/tmux/.config/tmux/cpu-load.sh) #[fg=#ffffff] #($HOME/.config/tmux/.config/tmux/mem-usage.sh) "
### For None Fancy Font Replace Icons With Text
set -g status-right-length 70
set -g status-justify left
set -g status-fg "#fffffe"
set -g status-bg "#343843"
## Panes
set -g pane-border-bg default
set -g pane-border-fg "#cc575d"
set -g pane-active-border-fg "#5294e2"
set -g pane-active-border-bg default
## Window
setw -g window-status-format "#[fg=#eeeeef bg=#343843]#{?window_activity_flag,#[fg=#111111 bg=#cc575d],} #I #W #{?window_bell_flag,,}#{?window_content_flag,,}#{?window_silence_flag,,}#{?window_last_flag,,}"
setw -g window-status-current-format "#[bg=#5294e2 fg=#ffffff bold] #I #W "
setw -g window-status-bell-style "fg=#111111 bg=#cc575d bold"
setw -g window-status-activity-style "fg=#111111 bg=#cc575d bold"
set -g window-status-separator '' # Remove space between windows in status bar
## Messaging
set -g message-fg "#ffffff"
set -g message-bg "#343843"
set -g message-attr bold
# 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