Created
December 23, 2025 17:34
-
-
Save krid78/8ed8f35f7d09b1ab96dcc32b604c4687 to your computer and use it in GitHub Desktop.
My tmux config as of 2025-12-23
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
| # Easier to type PREFIX than C-b | |
| # Ctrl-Space does not work when using windows Terminal | |
| # set-option -g prefix C-Space | |
| # vi/vim/nvim need ctrl-b | |
| # unbind-key C-b | |
| # Readline uses C-l to clear the screen - so we need a workaround | |
| # Use: <prefix> C-l | |
| bind C-b send-keys 'C-b' | |
| # vi-mappings to move between panes | |
| bind-key -r h select-pane -L | |
| bind-key -r j select-pane -D | |
| bind-key -r k select-pane -U | |
| bind-key -r l select-pane -R | |
| ######################################################################## | |
| # Smart pane switching with awareness of Vim splits. | |
| # See: https://github.com/christoomey/vim-tmux-navigator | |
| set-option -g focus-events on | |
| # 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:.+ | |
| #old: # Smart pane switching with awareness of Vim splits. | |
| #old: # See: https://github.com/christoomey/vim-tmux-navigator | |
| #old: is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| #old: | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
| #old: # bind-key -n S-Left if-shell "$is_vim" "send-keys S-Left" "select-pane -L" | |
| #old: # bind-key -n S-Down if-shell "$is_vim" "send-keys S-Down" "select-pane -D" | |
| #old: # bind-key -n S-Up if-shell "$is_vim" "send-keys S-Up" "select-pane -U" | |
| #old: # bind-key -n S-Right if-shell "$is_vim" "send-keys S-Right" "select-pane -R" | |
| #old: # bind-key -n C-S-Left if-shell "$is_vim" "send-keys C-S-Left" "select-pane -l" | |
| #old: # bind-key -n C-S-Right if-shell "$is_vim" "send-keys C-S-Right" "select-pane -l" | |
| #old: | |
| #old: # solution … https://github.com/christoomey/vim-tmux-navigator/issues/140 | |
| #old: bind-key -n S-Up if-shell "$is_vim" "send-keys C-w 'k'" "display-panes ; select-pane -U" | |
| #old: bind-key -n S-Down if-shell "$is_vim" "send-keys C-w 'j'" "display-panes ; select-pane -D" | |
| #old: bind-key -n S-Left if-shell "$is_vim" "send-keys C-w 'h'" "display-panes ; select-pane -L" | |
| #old: bind-key -n S-Right if-shell "$is_vim" "send-keys C-w 'l'" "display-panes ; select-pane -R" | |
| #old: bind-key -n C-S-Left if-shell "$is_vim" "send-keys C-w 'p'" "select-pane -l" | |
| #old: bind-key -n C-S-Right if-shell "$is_vim" "send-keys C-w 'v'" "split-window" | |
| ######################################################################## | |
| # Work-Arounds for the lost Ctrl-Bindings | |
| # Use <prefix> C-... to send the Ctrl-Command | |
| bind C-h send-keys 'C-h' | |
| bind C-j send-keys 'C-j' | |
| # C-k is delete until end of line | |
| bind C-k send-keys 'C-k' | |
| # Readline uses C-l to clear the screen - so we need a workaround | |
| bind C-l send-keys 'C-l' | |
| ######################################################################## | |
| # resize panes | |
| bind-key -r H resize-pane -L 5 | |
| bind-key -r J resize-pane -D 5 | |
| bind-key -r K resize-pane -U 5 | |
| bind-key -r L resize-pane -R 5 | |
| # screen mappings to move between windows | |
| bind-key -r p select-window -t :- | |
| bind-key -r n select-window -t :+ | |
| # renumber windows after closing one | |
| set-option -g renumber-windows on | |
| # make tmux more responsive, needed e.g. for nvim | |
| set -sg escape-time 10 | |
| # slower repeats | |
| set-option -g repeat-time 400 | |
| # Fix true colors for nvim | |
| set-option -sa terminal-overrides ',screen-256color:RGB' | |
| # Vim shortcuts for help and copy modes | |
| setw -g mode-keys vi | |
| # enable mouse | |
| set -g mouse on | |
| # set 256-color-terminal if applicable | |
| if-shell 'test $(tput colors) -ge 256' 'set-option -g default-terminal "screen-256color"' | |
| # Plugin management using Tmux Plugin Manager https://github.com/tmux-plugins/tpm | |
| # List of plugins | |
| set -g @plugin 'tmux-plugins/tpm' | |
| # tmux-sensible: basic tmux settings everyone can agree | |
| # set -g @plugin 'tmux-plugins/tmux-sensible' | |
| # tmux-resurrect: Persists tmux environment across system restarts. | |
| set -g @plugin 'tmux-plugins/tmux-resurrect' | |
| set -g @resurrect-dir '$HOME/.cache/tmux/resurrect' | |
| # tmux-menus - Popup menus to handle commands that are hard to remember, and some custom actions. | |
| set -g @menus 'jaclu/tmux-menus' | |
| # tmux-mighty-scroll - Seamless mouse scroll. | |
| set -g @mighty-scroll 'noscript/tmux-mighty-scroll' | |
| # 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) | |
| set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.config/tmux/plugins' | |
| run '~/.config/tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment