140 lines
6.7 KiB
Bash
140 lines
6.7 KiB
Bash
# set prefix key to Ctrl-a
|
|
set -g prefix C-a
|
|
|
|
# enable mouse mode
|
|
set -g mouse on
|
|
|
|
# set default terminal to xterm-256color
|
|
set -g default-terminal "tmux-256color"
|
|
|
|
# bind keys for pane navigation
|
|
bind h select-pane -L
|
|
bind j select-pane -D
|
|
bind k select-pane -U
|
|
bind l select-pane -R
|
|
|
|
# bind key for closing panes
|
|
bind x kill-pane
|
|
bind q confirm-before kill-session
|
|
# bind key for switching between windows
|
|
bind n next-window
|
|
bind p previous-window
|
|
|
|
# cheatsheet & reload
|
|
bind ? display-popup -h 27 -w 46 -E "echo -e '╔══════════════════════════════════════════╗\n║ Tmux Cheatsheet ║\n╠══════════════════════════════════════════╣\n║ Press Ctrl+A (prefix) then: ║\n╠══════════════════════════════════════════╣\n║ PANES ║\n║ h/j/k/l Navigate pane ║\n║ | Split horizontally ║\n║ - Split vertically ║\n║ x Kill pane ║\n║ Ctrl+S Swap pane layout ║\n╠══════════════════════════════════════════╣\n║ WINDOWS ║\n║ n Next window ║\n║ p Previous window ║\n║ q Kill session ║\n║ c New window ║\n║ , Rename window ║\n╠══════════════════════════════════════════╣\n║ GENERAL ║\n║ r Reload config ║\n║ ? This cheatsheet ║\n╚══════════════════════════════════════════╝\nPress any key to close.' && read -n 1 -s"
|
|
bind r source-file ~/.config/tmux/tmux.conf
|
|
|
|
# disable terminal flow control (so C-s doesn't freeze)
|
|
# set -g flow-control off # option not available in this tmux build
|
|
|
|
# bind key for toggling between horizontal and vertical split
|
|
bind C-s swap-pane -s .-1
|
|
|
|
# split panes using | and -
|
|
bind | split-window -h
|
|
bind - split-window -v
|
|
unbind '"'
|
|
unbind %
|
|
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-online-status'
|
|
set -g @plugin 'tmux-plugins/tmux-battery'
|
|
set -g @plugin 'tmux-plugins/tmux-cpu'
|
|
# GitHub Dark color palette
|
|
set -g @thm_bg "#0d1117"
|
|
set -g @thm_surface_0 "#161b22"
|
|
set -g @thm_overlay_0 "#30363d"
|
|
set -g @thm_red "#f85149"
|
|
set -g @thm_green "#3fb950"
|
|
set -g @thm_yellow "#d29922"
|
|
set -g @thm_blue "#58a6ff"
|
|
set -g @thm_mauve "#bc8cff"
|
|
set -g @thm_pink "#f778ba"
|
|
set -g @thm_peach "#f0883e"
|
|
set -g @thm_maroon "#ff7b72"
|
|
set -g @thm_rosewater "#c9d1d9"
|
|
|
|
# Configure Online
|
|
set -g @online_icon "ok"
|
|
set -g @offline_icon "nok"
|
|
|
|
# status left look and feel
|
|
set -g status-left-length 100
|
|
set -g status-left ""
|
|
set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_red},fg=#{@thm_bg},bold] #S },#{#[bg=#{@thm_bg},fg=#{@thm_green}] #S }}"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}] #{pane_current_command} "
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}] #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag, zoom ,}"
|
|
|
|
# status right look and feel
|
|
set -g status-right-length 100
|
|
set -g status-right ""
|
|
set -ga status-right "#{?#{e|>=:10,#{battery_percentage}},#{#[bg=#{@thm_red},fg=#{@thm_bg}]},#{#[bg=#{@thm_bg},fg=#{@thm_pink}]}} #{battery_icon} #{battery_percentage} "
|
|
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
|
|
set -ga status-right "#[bg=#{@thm_bg}]#{?#{==:#{online_status},ok},#[fg=#{@thm_mauve}] on ,#[fg=#{@thm_red},bold]#[reverse] off }"
|
|
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
|
|
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_blue}] %a, %m-%d-%Y %I:%M %p "
|
|
|
|
# start indexing at 1 (not 0)
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# misc quality-of-life
|
|
set -sg escape-time 0
|
|
set -g status-interval 5
|
|
set -g renumber-windows on
|
|
set -g focus-events on
|
|
setw -g aggressive-resize on
|
|
set -g set-clipboard on
|
|
|
|
# bootstrap tpm
|
|
if "test ! -d ~/.config/tmux/plugins/tpm" \
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
# auto-install a Nerd Font if missing (for icons)
|
|
run 'if ! fc-list :lang=en 2>/dev/null | grep -qi "nerd\\|jetbrainsmono\\|firacode\\|hack\\|iosevka\\|meslo"; then
|
|
mkdir -p ~/.local/share/fonts
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -sL "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/JetBrainsMono.zip" -o /tmp/jetbrains-nerd.zip
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
wget -q "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/JetBrainsMono.zip" -O /tmp/jetbrains-nerd.zip
|
|
fi
|
|
if [ -f /tmp/jetbrains-nerd.zip ]; then
|
|
unzip -qo /tmp/jetbrains-nerd.zip -d ~/.local/share/fonts/ 2>/dev/null
|
|
rm -f /tmp/jetbrains-nerd.zip
|
|
fc-cache -f ~/.local/share/fonts/ 2>/dev/null
|
|
fi
|
|
fi'
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
run '~/.config/tmux/plugins/tpm/tpm'
|
|
|
|
# Configure Tmux
|
|
set -g status-position bottom
|
|
set -g status-style "bg=#{@thm_bg}"
|
|
set -g status-justify "absolute-centre"
|
|
|
|
# pane border look and feel
|
|
setw -g pane-border-status bottom
|
|
setw -g pane-border-format ""
|
|
setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
|
|
setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
|
|
setw -g pane-border-lines single
|
|
|
|
# window look and feel
|
|
set -wg automatic-rename on
|
|
set -g automatic-rename-format "#{pane_current_command}"
|
|
|
|
set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
|
|
set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_rosewater}"
|
|
set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_peach}"
|
|
set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}"
|
|
set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
|
|
set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]│"
|
|
|
|
set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
|
|
set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_bg},bold"
|