Created
April 18, 2025 15:27
-
-
Save hieulw/04a1475f754276aa7b09880dab7cfe8a 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
| # Generals | |
| ## enable undercurl | |
| # https://github.com/AstroNvim/AstroNvim/issues/1336#issuecomment-1317609457 | |
| set -g default-terminal "${TERM}" | |
| set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' | |
| set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' | |
| ## color correction | |
| # https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour | |
| set -as terminal-features ",${TERM}*:RGB" | |
| set -as terminal-overrides ",${TERM}*:Tc" | |
| set -as terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # pipe cursor in vim insert mode | |
| ## image rendering | |
| # https://github.com/3rd/image.nvim?tab=readme-ov-file#tmux | |
| set -gq allow-passthrough on | |
| set -g visual-activity off | |
| # https://yazi-rs.github.io/docs/image-preview#tmux | |
| set -ga update-environment TERM | |
| set -ga update-environment TERM_PROGRAM | |
| # setw -g monitor-activity on | |
| set -g display-time 4000 | |
| set -g focus-events on | |
| set -g mouse on # disable mouse | |
| set -g detach-on-destroy off # don't exit from tmux when closing a session | |
| set -g escape-time 0 # zero-out escape time delay | |
| set -g history-limit 1000000 # significantly increase history size | |
| set -g renumber-windows on # renumber all windows when any window is closed | |
| set -g set-clipboard on # use system clipboard | |
| set -g base-index 1 # start indexing windows at 1 instead of 0 | |
| setw -g pane-base-index 1 | |
| setw -g mode-keys vi | |
| setw -g aggressive-resize on | |
| # Statusline | |
| set -g status-keys emacs | |
| set -g status-interval 2 # update status every 2 seconds | |
| set -g status-left-length 200 # increase status line length | |
| set -g status-position top # macOS / darwin style | |
| set -g pane-active-border-style 'fg=magenta,bg=default' | |
| set -g pane-border-style 'fg=brightblack,bg=default' | |
| set -g status-style 'bg=default' | |
| set -g window-status-current-format '#[fg=green]#W#{?window_zoomed_flag, ,}' | |
| set -g window-status-format '#[fg=gray]#W' | |
| set -g mode-style bg=default,fg=yellow | |
| set -g message-style bg=default,fg=yellow | |
| set -g message-command-style bg=default,fg=yellow | |
| set -g status-left '#[fg=cyan,bold]#S #[fg=blue] ' | |
| set -g status-right '#(gitmux "#{pane_current_path}")' | |
| # Keys Binding | |
| bind R source-file "~/.config/tmux/tmux.conf"\; display-message "reload configuration successfully!" | |
| bind m set mouse\; display-message "mouse is now #{?mouse,on,off}" | |
| bind -T copy-mode-vi v send -X begin-selection | |
| bind -T copy-mode-vi C-v send -X rectangle-toggle | |
| bind -T copy-mode-vi y send -X copy-selection-and-cancel | |
| bind x kill-pane # skip "kill-pane 1? (y/n)" prompt | |
| bind '%' split-window -c '#{pane_current_path}' -h | |
| bind '"' split-window -c '#{pane_current_path}' | |
| bind c new-window -c '#{pane_current_path}' | |
| bind g new-window -c '#{pane_current_path}' lazygit | |
| bind e new-window -c '#{pane_current_path}' yazi | |
| # See: https://github.com/mrjones2014/smart-splits.nvim?tab=readme-ov-file#tmux | |
| # '@pane-is-vim' is a pane-local option that is set by the plugin on load, | |
| # Smart pane switching with awareness of Neovim splits. | |
| bind-key -n C-h if -F "#{@pane-is-vim}" 'send-keys C-h' 'select-pane -L' | |
| bind-key -n C-j if -F "#{@pane-is-vim}" 'send-keys C-j' 'select-pane -D' | |
| bind-key -n C-k if -F "#{@pane-is-vim}" 'send-keys C-k' 'select-pane -U' | |
| bind-key -n C-l if -F "#{@pane-is-vim}" 'send-keys C-l' 'select-pane -R' | |
| # Smart pane resizing with awareness of Neovim splits. | |
| bind-key -n M-Left if -F "#{@pane-is-vim}" 'send-keys M-Left' 'resize-pane -L 3' | |
| bind-key -n M-Down if -F "#{@pane-is-vim}" 'send-keys M-Down' 'resize-pane -D 3' | |
| bind-key -n M-Up if -F "#{@pane-is-vim}" 'send-keys M-Up' 'resize-pane -U 3' | |
| bind-key -n M-Right if -F "#{@pane-is-vim}" 'send-keys M-Right' 'resize-pane -R 3' | |
| # Switch window with alt + number | |
| bind-key -n M-1 select-window -t 1 | |
| bind-key -n M-2 select-window -t 2 | |
| bind-key -n M-3 select-window -t 3 | |
| bind-key -n M-4 select-window -t 4 | |
| bind-key -n M-5 select-window -t 5 | |
| bind-key -n M-6 select-window -t 6 | |
| bind-key -n M-7 select-window -t 7 | |
| bind-key -n M-8 select-window -t 8 | |
| bind-key -n M-9 select-window -t 9 | |
| # Hack for extended keys work in tmux | |
| # See: https://github.com/tmux/tmux/issues/2705#issuecomment-1518520942 | |
| bind-key -T root F12 set key-table virt | |
| bind-key -T virt C-i if -F "#{@pane-is-vim}" "send-keys Escape '[105;5u'" "send-keys -H 09"\; set key-table root | |
| # Plugins Options | |
| set -g @resurrect-processes '"npm run dev"' | |
| set -g @continuum-restore 'on' | |
| set -g @t-fzf-prompt ' ' | |
| set -g @t-bind "j" | |
| set -g @t-border-label " Smart Session " | |
| set -g @fzf-url-fzf-options '-p 60%,30% --prompt=" " --border-label=" Open URL "' | |
| set -g @fzf-url-history-limit '2000' | |
| set -g @fingers-key 'y' | |
| # Plugins | |
| set -g @plugin 'wfxr/tmux-fzf-url' | |
| set -g @plugin 'hieulw/tmux-fzfsession' | |
| set -g @plugin 'morantron/tmux-fingers' | |
| set -g @plugin 'tmux-plugins/tpm' | |
| set -g @plugin 'tmux-plugins/tmux-resurrect' | |
| set -g @plugin 'tmux-plugins/tmux-continuum' | |
| set -g @plugin 'tmux-plugins/tmux-yank' | |
| if "test ! -d ~/.config/tmux/plugins/tpm" \ | |
| "run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm'" | |
| run -b '~/.config/tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment