Created
April 7, 2025 17:09
-
-
Save jby/1de177f49e028757a31eee08ac979134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unbind r | |
bind r source-file ~/.tmux.conf \; display "Reloaded tmux.conf" | |
if-shell "uname | grep -q Darwin" "set-option -g default-command \"reattach-to-user-namespace -l $SHELL\"" | |
set -g prefix '`' | |
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 -D | |
# Pane resize in all four directions using vi bindings. | |
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm. | |
bind-key J resize-pane -D | |
bind-key K resize-pane -U | |
bind-key H resize-pane -L | |
bind-key L resize-pane -R | |
# easily toggle synchronization (mnemonic: e is for echo) | |
# sends input to all panes in a given window. | |
bind e setw synchronize-panes on | |
bind E setw synchronize-panes off | |
# set first window to index 1 (not 0) to map more to the keyboard layout... | |
set-option -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
set-window-option -g mouse on | |
set -g renumber-windows on | |
# to be able to use mouse to select pane | |
#setw -g mouse-mode on | |
#set-option -g mouse-select-pane on | |
# NeoVim recommendations | |
set-option -sg escape-time 10 | |
set-option -g focus-events on | |
set-option -sa terminal-overrides ',xterm-256color:RGB' | |
# Bigger history | |
set -g history-limit 10000 | |
# Misc | |
bind 1 select-window -t 1 | |
bind 2 select-window -t 2 | |
bind 3 select-window -t 3 | |
bind 4 select-window -t 4 | |
bind 5 select-window -t 5 | |
bind 6 select-window -t 6 | |
bind 7 select-window -t 7 | |
bind 8 select-window -t 8 | |
bind 9 select-window -t 9 | |
bind 0 select-window -t 10 | |
set -g status-justify "centre" | |
#set -g status-position top | |
# Fix ssh socket and agent | |
# Remove SSH_AUTH_SOCK to disable tmux automatically resetting the variable | |
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID \ | |
SSH_CONNECTION WINDOWID XAUTHORITY" | |
# Use a symlink to look up SSH authentication | |
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock | |
# Screen like binding for last window | |
bind-key l last-window | |
bind-key ` send-prefix | |
bind-key S command-prompt -p ssh "new-window -n %1 'ssh %1'" | |
bind-key Q command-prompt -p ssh "split-window 'ssh %1'" | |
bind-key W command-prompt -p ssh "split-window -h 'ssh %1'" | |
# List of plugins | |
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
# is required | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'alexghergh/nvim-tmux-navigation' | |
# set -g @plugin 'dracula/tmux' | |
set -g @plugin 'catppuccin/tmux#v2.1.2' | |
set -g @plugin 'thepante/tmux-git-autofetch' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'AngryMorrocoy/tmux-neolazygit' | |
set -g @plugin 'tmux-plugins/tmux-battery' | |
set -g @plugin 'tmux-plugins/tmux-cpu' | |
set -g @plugin 'xamut/tmux-weather' | |
set -g @plugin 'gmoe/tmux-wifi' | |
set -g @plugin 'navahas/tmux-buoyshell' | |
# set -g @plugin 'niqodea/tmux-matryoshka' | |
# Smart pane switching with awareness of Vim splits. | |
# See: https://github.com/christoomey/vim-tmux-navigator | |
# decide whether we're in a Vim process | |
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' | |
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' | |
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' | |
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' | |
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' | |
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" | |
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" | |
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+' | |
bind-key -T copy-mode-vi 'C-h' select-pane -L | |
bind-key -T copy-mode-vi 'C-j' select-pane -D | |
bind-key -T copy-mode-vi 'C-k' select-pane -U | |
bind-key -T copy-mode-vi 'C-l' select-pane -R | |
bind-key -T copy-mode-vi 'C-\' select-pane -l | |
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+ | |
# Buoyshell config | |
set-option -g @buoyshell-title ' buoyshell ' | |
set-option -g @buoyshell-color '' # or add some color like #dcdcaa | |
set-option -g @buoyshell-height '80%' | |
set-option -g @buoyshell-width '60%' | |
set-option -g @buoyshell-x 'W' | |
set-option -g @buoyshell-y 'S' | |
# Custom Buoy Setup | |
bind-key -T prefix Q run-shell "custom_buoy standard personal-buoy" | |
bind-key -T prefix b run-shell "custom_buoy standard directories 'ls -la'" | |
bind-key -T prefix W run-shell "custom_buoy ephemeral system-monitor 'htop'" | |
# Catppuccin config | |
set -g @catppuccin_flavor 'mocha' # latte, frappe, macchiato or mocha | |
# Add the colors from the pallete. Check the themes/ directory for all options. | |
# Some basic mocha colors. | |
set -g @ctp_bg "#24273a" | |
set -g @ctp_surface_1 "#494d64" | |
set -g @ctp_fg "#cad3f5" | |
set -g @ctp_mauve "#c6a0f6" | |
set -g @ctp_crust "#181926" | |
# status line | |
set -gF status-style "bg=#{@ctp_bg},fg=#{@ctp_fg}" | |
# windows | |
set -gF window-status-format "#[bg=#{@ctp_surface_1},fg=#{@ctp_fg}] ##I ##T " | |
set -gF window-status-current-format "#[bg=#{@ctp_mauve},fg=#{@ctp_crust}] ##I ##T " | |
# Configure the catppuccin plugin | |
set -g @catppuccin_flavor "mocha" | |
set -g @catppuccin_window_status_style "rounded" | |
set -g @catppuccin_window_text " #W" | |
set -g @catppuccin_window_current_text " #T" | |
# Load catppuccin | |
run ~/.tmux/plugins/catppuccin/catppuccin.tmux | |
# For TPM, instead use `run ~/.config/tmux/plugins/tmux/catppuccin.tmux` | |
# # Configure 'tmux-matryoshka' | |
# # keybind to disable outer-most active tmux | |
# set -g @matryoshka_down_keybind 'M-d' | |
# # keybind to enable inner-most inactive tmux | |
# set -g @matryoshka_up_keybind 'M-u' | |
# # keybind to recursively enable all tmux instances | |
# set -g @matryoshka_up_recursive_keybind 'M-U' | |
# | |
# # to set the inactive status style, you can choose either to provide a fixed value... | |
# set -g @matryoshka_inactive_status_style_strategy 'assignment' | |
# set -g @matryoshka_inactive_status_style 'bg=colour238,fg=colour245' | |
# # ...or patch the existing status style with sed substitutions | |
# set -g @matryoshka_inactive_status_style_strategy 'sed' | |
# set -g @matryoshka_inactive_status_style 's/green/colour238/g; s/black/colour245/g' | |
# | |
# # name of the option for the style of the status line | |
# # set if you rely on something other than the default 'status-style' option for it | |
# set -g @matryoshka_status_style_option 'my-status-style' | |
# Make the status line pretty and add some modules | |
set -g status-right-length 100 | |
set -g status-left-length 100 | |
set -g status-left "" | |
set -g status-right "#{E:@catppuccin_status_application}" | |
set -agF status-right "#{E:@catppuccin_status_weather}" | |
set -agF status-right "#{E:@catppuccin_status_cpu}" | |
set -ag status-right "#{E:@catppuccin_status_session}" | |
set -agF status-right "#{E:@catppuccin_status_battery}" | |
set -ag status-right "#{E:@catppuccin_status_date_time}" | |
# # Dracula config | |
# set -g @dracula-show-powerline true | |
# set -g @dracula-show-fahrenheit false | |
# set -g @dracula-show-flags true | |
# set -g @dracula-show-left-icon session | |
# set -g @dracula-military-time true | |
# set -g @dracula-day-month true | |
# set -g @dracula-plugins "battery network git weather time" | |
# Initialize TMUX plugin manager | |
run '~/.tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment