Skip to content

Instantly share code, notes, and snippets.

@cfchou
Created April 17, 2025 03:30
Show Gist options
  • Save cfchou/fabcaa3fe119678ae7c4390f2fb27365 to your computer and use it in GitHub Desktop.
Save cfchou/fabcaa3fe119678ae7c4390f2fb27365 to your computer and use it in GitHub Desktop.
tmux.conf
# .tmux.conf modified from http://jcliang.twgogo.org
# General configuration.
# $ tmux show-options -g
set-option -g prefix C-a
## Reloads the configuration
bind r source-file ~/.tmux.conf
set -g base-index 1
set -g display-time 5000
set -g status-keys vi
#set -g status-utf8 on
set -g mode-style fg=black,bg=white
#set -g status-bg white
#set -g status-fg black
set -g status-justify left
set -g status-interval 1
set -g status-left-length 25
set -g status-right-length 55
set -g status-left "#[fg=white,bright,bg=blue] Session #[fg=yellow,bright,bg=blue]#S#[fg=white,bright,bg=blue], Pane #[fg=red,bright,bg=blue]#P #[default] |" # session-name:pane-number
set -g status-left "#[fg=white,bright,bg=blue] Session #[fg=yellow,bright,bg=blue]#S#[fg=white,bright,bg=blue], Pane #[fg=red,bright,bg=blue]#P #[default] |" # session-name:pane-number
#set -g status-right "#[fg=black,bright] %Y-%m-%d #[default]#[fg=blue,bright]%H:%M:%S #[default]"
# battery status
# https://raw.github.com/richo/battery/master/bin/battery
set -g status-right "♥ #(~/local/bin/battery Discharging; ~/local/bin/battery Charging) \
| #[fg=black,bright] %Y-%m-%d #[default]#[fg=blue,bright]%H:%M:%S #[default]"
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"
#set -g history-limit 9999
set -g history-limit 50000
setw -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Configuration for windows
# $ tmux show-window-options -g
#setw -g utf8 on
setw -g window-status-format " [#I] #W "
setw -g window-status-current-format " [#I] #W "
setw -g window-status-current-style bg=red,fg=white,default
#setw -g window-status-current-bg red
#setw -g window-status-current-fg white
#setw -g window-status-current-attr default
# Customization for key bindings.
# Check it using "C-a + ?".
## Make tmux like screen, using Ctrl+A
unbind C-b
set -g prefix C-a
bind a send-prefix
## Use A for renaming the window prompt.
bind -r A command-prompt "rename-window '%%'"
## Use C-a for last-window
bind C-a last-window
## Use '`' for choose-session
bind '`' choose-session
## ============
## Pane
## ============
# Use h and v for splitting.
bind | split-window -h
bind - split-window -v
# Pane resizing...
bind -r M-Up resize-pane -U
bind -r M-Down resize-pane -D
bind -r M-Left resize-pane -L
bind -r M-Right resize-pane -R
# Use j for join-pane -s, s for join-pane -t
bind m command-prompt -p "join pane from:" "join-pane -s '%%'"
bind s command-prompt -p "send pane to:" "join-pane -t '%%'"
# Pane select previous/next
bind -r k select-pane -t:.-
bind -r j select-pane -t:.+
set -g default-terminal "screen-256color"
# =============================
# https://github.com/tmux-plugins/tpm
# =============================
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'
# 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