Skip to content

Instantly share code, notes, and snippets.

@hnq90
Last active January 6, 2021 08:43
Show Gist options
  • Save hnq90/0d53930414147ac8ec73b7869b64990b to your computer and use it in GitHub Desktop.
Save hnq90/0d53930414147ac8ec73b7869b64990b to your computer and use it in GitHub Desktop.
.tmux.conf
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# solve the arrows mess when using vim in tmux
set -g default-terminal "xterm-256color"
# use mouse to scroll the output page instead of the command history
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# reload the file using Prefix-r
bind r source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded!"
# Switch pane, default is with -r (repeated without prefix)
bind Up select-pane -U
bind k select-pane -U
bind Down select-pane -D
bind j select-pane -D
bind Left select-pane -L
bind h select-pane -L
bind Right select-pane -R
bind l select-pane -R
# C-a t to kill-pane
bind -r t kill-pane
# Kill all other panes but the current one
bind T confirm-before "kill-pane -a"
# Kill current window
# bind -r x kill-window
# Kill all the other windows but the current one
bind X confirm-before "kill-window -a"
# Set Vi hot keys mode
setw -g mode-keys vi
# Start Window Numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# Aggressive resize(don't know what this means)
# setw -g aggressive-resize on
# Vertial split-window from current dir
bind -r v split-window -h -c "#{pane_current_path}"
bind -r \\ split-window -h -c "#{pane_current_path}"
# Horizontal split-window from current dir
bind -r h split-window -c "#{pane_current_path}"
bind -r - split-window -c "#{pane_current_path}"
# Create new window #from the current dir
bind c new-window -c "#{pane_current_path}"
# Copy/Paste between system clipboard and tmux
set -g mouse on
# Toggle mouse on/off
bind m set -g mouse
# Scrollback limit
set -g history-limit 50000
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
# Automatically set window title to reflect the current program
setw -g automatic-rename off
# Disable C-z to suspend tmux
unbind-key C-z
# Disable C-d to exit shell, this C-d happens when being first input to prompt
unbind-key C-d
# Gotty
bind-key C-f new-window "gotty tmux attach -t `tmux display -p '#S'`"
# Rename your terminals
set -g set-titles on
set -g set-titles-string '#(whoami)::#h'
# Status bar customization
set -g status-style bg=black,fg=white
set -g status-interval 5
set -g status-left-length 90
set -g status-right-length 120
set -g status-left "#[fg=Green]#(whoami)#[fg=white]@#[fg=blue]#(hostname -s)#[fg=white] | ##[fg=yellow]"
set -g status-justify left
set -g status-right '#{prefix_highlight} Session: #[fg=Cyan]#S | #[fg=white]%a %d %b %R'
# Highlight active window
setw -g window-status-current-style fg=red,bright
set -g pane-active-border-style fg=red
# Identify activity in other windows
setw -g monitor-activity on
set -g visual-activity on
setw -g window-status-activity-style bold,blink,underscore
setw -g window-status-format "[#I#([ #{window_panes} -gt 1 ] && echo :#{window_panes})]:#{pane_current_command}#F"
bind s list-panes -a -F '#S:#I:#P-#{pane_height}x#{pane_width} "#{pane_title}" #{history_size}'
set -g message-style fg=red,bg=default,bright
set -g display-time 3000
# re-number windows when one is closed
set -g renumber-windows on
# enable UTF-8 support in status bar
set -gq status-utf8 on
# Retrieve persisted tmux after restart
# https://github.com/tmux-plugins/tmux-resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Automaticually saves tmux session every 15mins
# https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
# Allow copy and paste from tmux
# https://github.com/tmux-plugins/tmux-yank
set -g @plugin 'tmux-plugins/tmux-yank'
# tmux-copycat
set -g @plugin 'tmux-plugins/tmux-copycat'
# tmux-fpp
set -g @plugin 'jbnicolai/tmux-fpp'
# tmux-open
set -g @plugin 'tmux-plugins/tmux-open'
# tmux-online-status
# set -g @plugin 'tmux-plugins/tmux-online-status'
# tmux-cpu
# set -g @plugin 'tmux-plugins/tmux-cpu'
# tmux-mem-cpu-load
# set -g @plugin 'thewtex/tmux-mem-cpu-load'
# tmux-highlight prefix
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# tmux-better-mouse-mode
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
@hnq90
Copy link
Author

hnq90 commented May 3, 2019

Update config for tmux 2.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment