/ .config / tmux / tmux.conf
tmux.conf
  1  # Enable True color support
  2  set -g default-terminal "tmux-256color"
  3  set -ag terminal-overrides ",xterm-256color:RGB"
  4  set -gq allow-passthrough on
  5  
  6  set -g base-index 1
  7  set -g pane-base-index 1
  8  
  9  set-option -g prefix C-b
 10  set-option -g prefix2 none
 11  
 12  # Utility bindings
 13  unbind r
 14  bind r source-file ~/.config/tmux/tmux.conf
 15  
 16  unbind %
 17  bind | split-window -h -c "#{pane_current_path}"
 18  
 19  unbind '"'
 20  bind - split-window -v -c "#{pane_current_path}"
 21  
 22  unbind v
 23  bind v copy-mode
 24  
 25  # resizing panes with hjkl
 26  bind -r j resize-pane -D 5
 27  bind -r k resize-pane -U 5
 28  bind -r l resize-pane -R 5
 29  bind -r h resize-pane -L 5
 30  
 31  # maximize panes
 32  bind -r m resize-pane -Z
 33  
 34  # mouse support
 35  set -g mouse on
 36  
 37  # vim shell navigations and selects in tmux panes
 38  set-window-option -g mode-keys vi
 39  bind-key -T copy-mode-vi 'v' send -X begin-selection
 40  bind-key -T copy-mode-vi 'y' send -X copy-selection
 41  
 42  # Instant switch to a new tmux session directory that exist
 43  bind-key -r f run-shell "tmux neww ~/scripts/tmux-sessionizer"
 44  bind-key n command-prompt "new-session -s '%%'"
 45  bind-key C-e display-popup -d "#{pane_current_path}" -w 90% -h 90% -E "yazi" # yazi float
 46  bind-key C-t display-popup -d "#{pane_current_path}" -w 80% -h 80% -E "nushell" # quick floating terminal
 47  bind-key C-g display-popup -d "#{pane-current-path}" -w 90% -h 90% -E "lazygit" # lazygit float
 48  bind-key C-m display-popup -w 95% -h 95% -E "rmpc" # music float
 49  bind d display-menu -T "#[align=centre]Config" -x C -y C \
 50      ".zshrc"            z  "display-popup -w 75% -h 75% -E 'nvim ~/.zshrc'" \
 51      ".zprofile"         p  "display-popup -w 75% -h 75% -E 'nvim ~/.zprofile'" \
 52      ".tmux.conf"        t  "display-popup -w 75% -h 75% -E 'nvim ~/.tmux.conf'" \
 53      ".nvim"             v  "display-popup -d "~/dotfiles/nvim/.config/nvim" -E 'nvim ~/dotfiles/nvim/.config/nvim'" \
 54      "quit"              q  ""
 55  
 56  # Drag copy using mouse
 57  unbind -T copy-mode-vi MouseDragEnd1Pane
 58  
 59  # tmux plugin manager 
 60  set-environment -g TMUX_PLUGIN_MANAGER_PATH ~/.config/tmux/.tmux/plugins
 61  set -g @plugin 'tmux-plugins/tpm' # must be the first plugin
 62  set -g @plugin "christoomey/vim-tmux-navigator"
 63  
 64  # set -g @plugin 'omerxx/tmux-sessionx' # default keybind "<prefix> O" to activate
 65  # set -g @plugin "tmux-plugins/tmux-resurrect" #persist tmux sessions after computer restart
 66  set -g @plugin "tmux-plugins/tmux-continuum" #automatically save sessions every 15mins
 67  
 68  set -g @plugin 'catppuccin/tmux'
 69  set -g @plugin 'tmux-plugins/tmux-online-status'
 70  set -g @plugin 'tmux-plugins/tmux-battery'
 71  
 72  set -g @sessionx-bind 'o'
 73  set -g @resurrect-capture-pane-contents "on"
 74  set -g @continuum-restore "on"
 75  
 76  # Configure Catppuccin
 77  set -g @catppuccin_flavor "mocha"
 78  set -g @catppuccin_status_background "none"
 79  set -g @catppuccin_window_status_style "none"
 80  set -g @catppuccin_pane_status_enabled "off"
 81  set -g @catppuccin_pane_border_status "off"
 82  
 83  # Configure Online status
 84  set -g @online_icon "ok"
 85  set -g @offline_icon "nok"
 86  
 87  # status left look and feel
 88  set -g status-left-length 100
 89  set -g status-left ""
 90  set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_red},fg=#{@thm_bg},bold]  #S },#{#[bg=#{@thm_bg},fg=#{@thm_green}]  #S }}"
 91  # set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
 92  # set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}]  #{pane_current_command} "
 93  set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
 94  set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}]  #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
 95  set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
 96  set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag,  zoom ,}"
 97  
 98  # status right look and feel
 99  set -g status-right-length 100
100  set -g status-right ""
101  set -ga status-right "#{?#{e|>=:10,#{battery_percentage}},#{#[bg=#{@thm_red},fg=#{@thm_bg}]},#{#[bg=#{@thm_bg},fg=#{@thm_green}]}} #{battery_icon} #{battery_percentage} "
102  set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
103  set -ga status-right "#[bg=#{@thm_bg}]#{?#{==:#{online_status},ok},#[fg=#{@thm_rosewater}] 󰖩 on ,#[fg=#{@thm_red},bold]#[reverse] 󰖪 off }"
104  # set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
105  # set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_blue}] 󰭦 %Y-%m-%d 󰅐 %H:%M "
106  
107  
108  # Configure Tmux
109  set -g status-position top 
110  set -g status-style "bg=#{@thm_bg}"
111  set -g status-justify "absolute-centre"
112  
113  # pane border look and feel
114  # setw -g pane-border-status top
115  # setw -g pane-border-format ""
116  # setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
117  # setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
118  # setw -g pane-border-lines single
119  
120  # window look and feel
121  set -wg automatic-rename on
122  set -g automatic-rename-format "#{pane_current_command}"
123  
124  set -g window-status-format " #I#{?#{!=:#{window_name},Window}, #W,} "
125  set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_blue}"
126  set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_blue}"
127  set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}"
128  set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
129  set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]󱪼"
130  
131  set -g window-status-current-format " #I#{?#{!=:#{window_name},Window}, #W,} "
132  set -g window-status-current-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
133  
134  run '~/.config/tmux/.tmux/plugins/tpm/tpm' # always keep this line last