mirror of
https://github.com/theniceboy/.config.git
synced 2025-12-26 14:44:57 +08:00
289 lines
11 KiB
Bash
289 lines
11 KiB
Bash
# cat << EOF > /dev/null
|
|
|
|
# -- general
|
|
# set-option default-path "$PWD" # deprecated in tmux 1.9
|
|
|
|
setw -g xterm-keys on
|
|
set -s escape-time 0
|
|
set -sg repeat-time 300
|
|
set -s focus-events on
|
|
set -s extended-keys on
|
|
set -as terminal-features 'xterm*:extkeys'
|
|
set -g mouse on
|
|
set -sg exit-empty on
|
|
set -g detach-on-destroy off
|
|
|
|
set -q -g status-utf8 on
|
|
setw -q -g utf8 on
|
|
|
|
set -g visual-activity off
|
|
setw -g monitor-activity off
|
|
setw -g monitor-bell off
|
|
|
|
set -g history-limit 10000
|
|
|
|
set-hook -g pane-focus-in "run -b 'bash ~/.config/tmux/fzf_panes.tmux update_mru_pane_ids'"
|
|
|
|
# reload configuration
|
|
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
|
|
|
|
set -ga update-environment '\
|
|
DISPLAY DBUS_SESSION_BUS_ADDRESS \
|
|
QT_IM_MODULE QT_QPA_PLATFORMTHEME \
|
|
SESSION_MANAGER \
|
|
XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME\
|
|
XDG_MENU_PREFIX XDG_RUNTIME_DIR XDG_SESSION_CLASS \
|
|
XDG_SESSION_DESKTOP XDG_SESSION_TYPE XDG_CURRENT_DESKTOP \
|
|
XMODIFIERS \
|
|
FZF_DEFAULT_OPTS \
|
|
TMUX_THEME_COLOR \
|
|
'
|
|
# set-hook -gu client-attached
|
|
# set-hook -g client-attached 'run -b "cut -c3- ~/.tmux.conf | sh -s update_env_event"'
|
|
# Acknowledge the current pane's task when a client attaches
|
|
set-hook -ag client-attached 'run -b "~/.config/agent-tracker/bin/tracker-client command acknowledge --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id}"'
|
|
set-hook -ag client-attached 'run -b "tmux refresh-client -S"'
|
|
|
|
# set-hook -gu client-resized
|
|
# set-hook -ag client-resized 'run -b "~/.config/agent-tracker/bin/tracker-client command refresh --client #{client_tty}"'
|
|
# set-hook -ag client-resized 'run -b "tmux refresh-client -S"'
|
|
|
|
set-hook -ag pane-focus-in 'run -b "~/.config/agent-tracker/bin/tracker-client command acknowledge --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id}"'
|
|
set-hook -ag pane-focus-in 'run -b "tmux refresh-client -S"'
|
|
set-hook -ag pane-died 'run -b "~/.config/agent-tracker/bin/tracker-client command delete_task --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id}"'
|
|
# set-hook -ag window-linked 'run -b "tmux refresh-client -S"'
|
|
# set-hook -ag window-unlinked 'run -b "tmux refresh-client -S"'
|
|
# set-hook -ag window-renamed 'run -b "tmux refresh-client -S"'
|
|
# set-hook -ag window-layout-changed 'run -b "tmux refresh-client -S"'
|
|
# set-hook -ag after-kill-window 'run -b "tmux refresh-client -S"'
|
|
#
|
|
# set-hook -gu client-session-changed
|
|
# set-hook -g client-session-changed 'run -b "tmux refresh-client -S"'
|
|
#
|
|
set-hook -gu session-created
|
|
set-hook -ag session-created 'run -b "~/.config/tmux/scripts/session_created.sh"'
|
|
set-hook -ag session-created 'run -b "tmux refresh-client -S"'
|
|
|
|
set-hook -gu session-renamed
|
|
set-hook -g session-renamed 'run -b "tmux refresh-client -S"'
|
|
|
|
set-hook -gu session-closed
|
|
set-hook -g session-closed 'run -b "tmux refresh-client -S"'
|
|
|
|
run-shell "~/.config/tmux/scripts/session_created.sh"
|
|
|
|
# -- prefix
|
|
unbind C-b
|
|
set -g prefix 'C-s'
|
|
|
|
# -- display
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
setw -g automatic-rename on
|
|
set -g renumber-windows on
|
|
|
|
set -g set-titles on
|
|
|
|
set -g display-panes-time 2000
|
|
set -g display-time 2000
|
|
|
|
|
|
# -- navigation
|
|
|
|
# create session
|
|
bind C-c new-session
|
|
bind -n M-S run-shell "~/.config/tmux/scripts/new_session.sh"
|
|
bind -n M-O break-pane
|
|
bind -n M-s run-shell "~/.config/tmux/scripts/toggle_scratchpad.sh"
|
|
|
|
# window management
|
|
bind -n M-o new-window -c "#{pane_current_path}"
|
|
bind -n M-Q kill-pane
|
|
bind -n M-t run-shell "~/.config/agent-tracker/bin/tracker-client command toggle --client '#{client_tty}'"
|
|
bind . command-prompt -p "Rename session to:" "run-shell \"~/.config/tmux/scripts/rename_session_prompt.sh '%%'\""
|
|
unbind ,
|
|
bind , command-prompt -p "Rename window:" "rename-window '%%'"
|
|
|
|
# window navigation
|
|
unbind n
|
|
unbind p
|
|
unbind 1
|
|
unbind 2
|
|
unbind 3
|
|
unbind 4
|
|
unbind 5
|
|
unbind 6
|
|
unbind 7
|
|
unbind 8
|
|
unbind 9
|
|
unbind 0
|
|
bind -r C-p previous-window
|
|
bind -r C-n next-window
|
|
|
|
bind -n M-1 select-window -t 1
|
|
bind -n M-2 select-window -t 2
|
|
bind -n M-3 select-window -t 3
|
|
bind -n M-4 select-window -t 4
|
|
bind -n M-5 select-window -t 5
|
|
bind -n M-6 select-window -t 6
|
|
bind -n M-7 select-window -t 7
|
|
bind -n M-8 select-window -t 8
|
|
bind -n M-9 select-window -t 9
|
|
|
|
|
|
bind -n M-! join-pane -t :1
|
|
bind -n M-@ join-pane -t :2
|
|
bind -n 'M-#' join-pane -t :3
|
|
bind -n 'M-$' join-pane -t :4
|
|
bind -n M-% join-pane -t :5
|
|
bind -n M-^ join-pane -t :6
|
|
bind -n M-& join-pane -t :7
|
|
bind -n M-* join-pane -t :8
|
|
bind -n M-( join-pane -t :9
|
|
|
|
bind u split-window -vb -c "#{pane_current_path}"
|
|
bind e split-window -v -c "#{pane_current_path}"
|
|
bind n split-window -hb -c "#{pane_current_path}"
|
|
bind i split-window -h -c "#{pane_current_path}"
|
|
|
|
bind -n M-f resize-pane -Z
|
|
|
|
# paste from system clipboard
|
|
bind -n C-S-v run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
bind -T copy-mode-vi C-S-v send-keys -X cancel \; run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
bind -T copy-mode C-S-v send-keys -X cancel \; run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
|
|
# Alt+Shift+V paste
|
|
bind -n M-V run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
bind -T copy-mode-vi M-V send-keys -X cancel \; run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
bind -T copy-mode M-V send-keys -X cancel \; run -b "~/.config/tmux/scripts/paste_from_clipboard.sh"
|
|
|
|
# pane navigation
|
|
bind 1 select-pane -t:.1
|
|
bind 2 select-pane -t:.2
|
|
bind 3 select-pane -t:.3
|
|
bind 4 select-pane -t:.4
|
|
bind 5 select-pane -t:.5
|
|
bind 6 select-pane -t:.6
|
|
bind 7 select-pane -t:.7
|
|
bind 8 select-pane -t:.8
|
|
bind 9 select-pane -t:.9
|
|
bind 0 select-pane -t:.10
|
|
bind -n M-n select-pane -L
|
|
bind -n M-e select-pane -D
|
|
bind -n M-u select-pane -U
|
|
bind -n M-i select-pane -R
|
|
bind > swap-pane -D
|
|
bind < swap-pane -U
|
|
bind | swap-pane
|
|
bind -n M-m run-shell "bash ~/.config/agent-tracker/scripts/focus_latest_notified.sh"
|
|
bind -n M-M run-shell "bash ~/.config/agent-tracker/scripts/focus_last_origin.sh"
|
|
bind Space run-shell "~/.config/tmux/scripts/toggle_orientation.sh"
|
|
|
|
bind W choose-tree -Z
|
|
bind S choose-tree 'move-pane -v -s "%%"'
|
|
bind V choose-tree 'move-pane -h -s "%%"'
|
|
|
|
# pane resizing
|
|
bind -n M-N resize-pane -L 3
|
|
bind -n M-E resize-pane -D 3
|
|
bind -n M-U resize-pane -U 3
|
|
bind -n M-I resize-pane -R 3
|
|
|
|
set -g status-keys emacs
|
|
set -g mode-keys vi
|
|
|
|
bind -n M-v copy-mode
|
|
|
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
|
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
|
|
bind -T copy-mode-vi n send-keys -X cursor-left
|
|
bind -T copy-mode-vi i send-keys -X cursor-right
|
|
bind -T copy-mode-vi u send-keys -X cursor-up
|
|
bind -T copy-mode-vi e send-keys -X cursor-down
|
|
bind -T copy-mode-vi h send-keys -X next-word-end
|
|
bind -T copy-mode-vi U send-keys -N 5 -X cursor-up
|
|
bind -T copy-mode-vi E send-keys -N 5 -X cursor-down
|
|
bind -T copy-mode-vi N send-keys -X start-of-line
|
|
bind -T copy-mode-vi I send-keys -X end-of-line
|
|
bind -T copy-mode-vi Y send-keys -X copy-end-of-line
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "~/.config/tmux/scripts/copy_to_clipboard.sh"
|
|
bind -T copy-mode-vi = send-keys -X search-again
|
|
bind -T copy-mode-vi = send-keys -X search-reverse
|
|
|
|
|
|
bind b list-buffers
|
|
bind p paste-buffer
|
|
|
|
bind l run-shell "~/.config/tmux/scripts/move_session.sh left"
|
|
bind y run-shell "~/.config/tmux/scripts/move_session.sh right"
|
|
bind -n M-l swap-window -d -t :-1
|
|
bind -n M-y swap-window -d -t :+1
|
|
|
|
bind I run-shell "~/.config/tmux/scripts/layout_builder.sh right"
|
|
bind N run-shell "~/.config/tmux/scripts/layout_builder.sh left"
|
|
bind U run-shell "~/.config/tmux/scripts/layout_builder.sh up"
|
|
bind E run-shell "~/.config/tmux/scripts/layout_builder.sh down"
|
|
|
|
# -- toggle_syn_input
|
|
bind C-g if-shell '[[ $(tmux showw synchronize-panes | cut -d\ -f2) == "on" ]]' \
|
|
'setw synchronize-panes off; set -g pane-border-style fg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb}' \
|
|
'setw synchronize-panes on; set -g pane-border-style fg=red'
|
|
|
|
# -- toggle_status
|
|
|
|
# -- theme
|
|
|
|
# panes
|
|
run-shell "~/.config/tmux/scripts/update_theme_color.sh"
|
|
setw -g pane-border-status top
|
|
set -g pane-active-border-style fg=#b294bb
|
|
set -g pane-border-style fg=colour244
|
|
setw -g pane-border-format '#{?pane_active, #[fg=#{@theme_color}]#[bg=#{@theme_color}]#[fg=#1d1f21]#[bold] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=#{@theme_color}]#[default], #[fg=colour244]#[bg=colour244]#[fg=#1d1f21] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=colour244]#[default] }'
|
|
#set -g pane-active-border-style fg=brightblue
|
|
#set -g pane-border-style fg=magenta
|
|
|
|
# windows
|
|
|
|
# windows
|
|
set -g status-justify 'left'
|
|
set -g status-left-length 90
|
|
set -g status-right-length 140
|
|
setw -g window-status-separator ''
|
|
|
|
# default statusbar colors
|
|
set -g status-bg black
|
|
#set -g status-left ' #[fg=magenta,bold]❐ #S'
|
|
#set -g status-left '#[fg=brightyellow] #{?client_prefix,⌨ , } #[fg=magenta,bold] %Y-%m-%d %H:%M '
|
|
#set -g status-right '#(rainbarf --battery --remaining --bolt --tmux --rgb)'
|
|
#set -g status-left "#[fg=magenta,bold] %Y-%m-%d %H:%M | #[fg=brightblue]#(curl icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig en3 | grep 'inet ' | awk '{print \"en3 \" $2}') #(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
|
|
setw -g window-status-format '#[fg=#c5c8c6] #W '
|
|
setw -g window-status-current-format '#[fg=#{@theme_color},bold] #W '
|
|
setw -g window-status-activity-style bg=black
|
|
setw -g window-status-bell-style bg=black
|
|
#set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
|
|
|
|
set-option -g status-left "#(~/.config/tmux/tmux-status/left.sh \"#{session_id}\" \"#{session_name}\") "
|
|
set-option -g status-right "#(~/.config/tmux/tmux-status/right.sh)"
|
|
|
|
|
|
# session index switching
|
|
bind -n C-1 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 1"
|
|
bind -n C-2 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 2"
|
|
bind -n C-3 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 3"
|
|
bind -n C-4 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 4"
|
|
bind -n C-5 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 5"
|
|
bind -n C-6 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 6"
|
|
bind -n C-7 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 7"
|
|
bind -n C-8 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 8"
|
|
bind -n C-9 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 9"
|
|
bind -n F1 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 1"
|
|
bind -n F2 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 2"
|
|
bind -n F3 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 3"
|
|
bind -n F4 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 4"
|
|
bind -n F5 run-shell "~/.config/tmux/scripts/switch_session_by_index.sh 5"
|
|
# True color support
|
|
set -g default-terminal "tmux-256color"
|
|
set -as terminal-features ",*256col*:RGB"
|
|
set -as terminal-overrides ",*256col*:Tc"
|