Files
AstroVim_Config/.config/.tmux.conf
2025-02-07 17:08:39 +07:00

175 lines
6.1 KiB
Bash

set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
set-option -g focus-events on
# -- general -------------------------------------------------------------------
set -g mouse on
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 500 # increase repeat timeout
set -s focus-events on
set -g prefix2 C-b # GNU-Screen compatible prefix
bind C-b send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g history-limit 5000 # boost history
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse
# remove delay for exiting insert mode with ESC in Neovim
set -sg escape-time 10
# edit configuration
%if #{>=:#{version},3.0}
bind e new-window -n "#{TMUX_CONF_LOCAL}" -e EDITOR="$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
%else
set-environment -g EDITOR "$EDITOR"
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
%endif
# reload configuration
bind r run "sh -c '\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} source \"\$TMUX_CONF\"'" \; display "#{TMUX_CONF} sourced"
set-window-option -g mode-keys vi
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 10 # redraw status line every 10 seconds
# activity
set -g monitor-activity on
set -g visual-activity off
set -g monitor-activity off
set -g bell-action none
set -g visual-bell off
# -- navigation ----------------------------------------------------------------
# create session
# bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# session navigation
bind BTab switch-client -l # move to last session
# split current window horizontally
bind - split-window -v -c "#{pane_current_path}"
# split current window vertically
bind _ split-window -h -c "#{pane_current_path}"
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind C-q swap-pane -D # swap current pane with the next one
bind C-e swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'"
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
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 -T copy-mode-vi Escape send -X cancel
bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line
# NOTE: --------------------------------------------------------------------------------------------------------------------
# tpm plugin
set -g @plugin 'catppuccin/tmux'
# set -g @plugin 'xamut/tmux-weather'
set -g @plugin 'tmux-plugins/tpm'
# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
# set -g @plugin 'fabioluciano/tmux-tokyo-night'
# run ~/.tmux/plugins/catppuccin/catppuccin.tmux
# NOTE: ...alongside
set -g @catppuccin_flavour "mocha"
set -g @catppuccin_window_left_separator " "
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator "|"
# set -g @catppuccin_window_middle_separator ""
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "all"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "user host"
set -g @catppuccin_status_modules_left "session "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_left_separator " "
# set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_middle_separator "|"
set -g @catppuccin_status_fill "all"
set -g @catppuccin_status_connect_separator "yes"
set -g @catppuccin_window_status_icon_enable "yes"
set -g @catppuccin_window_status_enable "yes"
set -g @catppuccin_status_default "on"
# icons
set -g @catppuccin_icon_window_last "󰃀 "
set -g @catppuccin_icon_window_current " "
set -g status-position top
# set -g @catppuccin_directory_text "#{pane_current_path}"
# end it
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'