Skip to content

Instantly share code, notes, and snippets.

@Sarctiann
Last active June 24, 2024 14:03
Show Gist options
  • Save Sarctiann/1011e0527dfef5f7ae270721e1a21080 to your computer and use it in GitHub Desktop.
Save Sarctiann/1011e0527dfef5f7ae270721e1a21080 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set-option -g focus-events on
set-option -sg escape-time 10
set-option -g default-shell /bin/zsh
setw -g status-position top
set -g mouse on
# Start windows and panes at 1 for better ergonomics when switching between them.
set -g base-index 1
setw -g pane-base-index 1
setw -g xterm-keys on
# Shortcuts for manage sessions and windows
# Sessions
bind-key -n C-M-s new-session
bind-key -n M-s confirm-before -p "Kill #S (y/N)?" "switch-client -n\; kill-session -t \"#S\""
# Linux Version: confirm-before -p "Kill #S (y/N)?" "run-shell 'tmux switch-client -n; tmux kill-session -t \"#S\"'"
bind-key -n C-M-r command-prompt -p "New session name:" "rename-session '%%'"
bind-key -n M-S-Left switch-client -p
bind-key -n M-S-Right switch-client -n
# Windows
bind-key -n C-M-w new-window -c "#{pane_current_path}"
bind-key -n M-w confirm-before -p "Kill window #I? (y/N)"\
"if-shell \"test '#{session_windows}' -eq 1\"\
'switch-client -n\; kill-session -t \"#S\"'\
'kill-window'"
# Linux Version: confirm-before -p "Kill window #I? (y/N)"\
# "if-shell \"test '#{session_windows}' -eq 1\"\
# \"run-shell 'tmux switch-client -n; tmux kill-session -t \"#S\"'\"\
# 'kill-window'"
bind-key -n M-, previous-window
bind-key -n M-. next-window
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 9
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# Other Handy shortcuts
bind-key -n M-Left send-keys M-b
bind-key -n M-Right send-keys M-f
# TokyoNight colors for Tmux (tokyonight.nvim)
set -g mode-style "fg=#30a0d0,bg=#3b4261"
set -g message-style "fg=#30a0d0,bg=#3b4261"
set -g message-command-style "fg=#30a0d0,bg=#3b4261"
set -g pane-border-style "fg=#3b4261"
set -g pane-active-border-style "fg=#30a0d0"
set -g status "on"
set -g status-justify "left"
set -g status-style "fg=#30a0d0,bg=#16161e"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-style NONE
set -g status-right-style NONE
set -g status-left "#[fg=#16161e,bg=#30a0d0,bold] #S #[fg=#30a0d0,bg=#16161e,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#30a0d0,bg=#16161e] #{prefix_highlight} #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#30a0d0,bg=#3b4261]  %Y-%m-%d  󰥔 %H:%M #[fg=#30a0d0,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#15161e,bg=#30a0d0,bold] #h "
setw -g window-status-activity-style "underscore,fg=#a9b1d6,bg=#16161e"
setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#a9b1d6,bg=#16161e"
setw -g window-status-format "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[default] #I #W #[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#16161e,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#30a0d0,bg=#3b4261,bold] #I #W #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]"
# tmux-plugins/tmux-prefix-highlight support
set -g @prefix_highlight_output_prefix "#[fg=#e0af68]#[bg=#16161e]#[fg=#16161e]#[bg=#e0af68]"
set -g @prefix_highlight_output_suffix ""
# Undercurl
set -g default-terminal "${TERM}"
set -ag terminal-overrides ",$TERM:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# For Yazi image previewer
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment