mirror of
https://github.com/boxpositron/absolute-dotfiles.git
synced 2026-10-24 08:23:19 +00:00
c9059d4867
mosh drops the OSC 777 banner that omo-notify posts, so omo sessions on the server only reached the phone through ntfy. The server's omo-notify now writes the session state into its tmux client's terminal title (omo:<state>:<time>:<project>), which mosh and ssh carry. A pane-title-changed hook hands it to the new omo-remote, which runs omo-notify for the local mosh pane through the new OMO_NOTIFY_PANE override, so remote sessions get the same sound, tab marker and banner as local ones. Sessions that no terminal is showing come through ntfy instead: omo-remote install starts a launchd agent running ntfy subscribe, which plays the sound and posts the banner for omo pushes the server did not tag attached. Brewfile gains ntfy; the token lives in ~/.config/ntfy/omo-remote.env, outside the repository.
156 lines
5.5 KiB
Bash
156 lines
5.5 KiB
Bash
set -g mouse on
|
|
bind r source-file ~/.tmux.conf
|
|
set-option -a terminal-features 'xterm*:RGB'
|
|
# Extended keys so TUIs (omo, nvim) receive Shift+Enter and other modified keys
|
|
set -g extended-keys on
|
|
set -g extended-keys-format csi-u
|
|
set-option -a terminal-features 'xterm*:extkeys'
|
|
set-option -sg escape-time 10
|
|
set-option -g focus-events on
|
|
set-window-option -g mode-keys vi
|
|
set-option -g renumber-windows on
|
|
# Allow passthrough
|
|
set -gq allow-passthrough on
|
|
set -g visual-activity off
|
|
|
|
set -ga update-environment TERM
|
|
set -ga update-environment TERM_PROGRAM
|
|
|
|
# Key Bindings
|
|
# Auto Source tmux.conf
|
|
unbind r
|
|
bind r source-file ~/.tmux.conf \; display "Reloaded!"
|
|
|
|
|
|
# Set binding for searching with / and ?
|
|
bind-key / copy-mode \; send-key ?
|
|
|
|
# Setting up vi binds for tmux copy mode
|
|
bind-key -T copy-mode-vi "v" send-keys -X begin-selection
|
|
bind-key -T copy-mode-vi "y" send-keys -X copy-selection
|
|
|
|
unbind -T copy-mode-vi MouseDragEnd1Pane
|
|
|
|
# Setting up vertical split with |
|
|
unbind %
|
|
bind | split-window -h -c '#{pane_current_path}'
|
|
|
|
# Set base index to 1
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# Set kill pane to Shift + Option + X
|
|
bind -n M-X kill-pane
|
|
|
|
# Setting up horizontal split with -
|
|
unbind '"'
|
|
bind - split-window -v -c '#{pane_current_path}'
|
|
|
|
unbind 'C'
|
|
bind C attach-session -c "#{pane_current_path}"
|
|
|
|
# Setting up window movement with leader key + Left/Right arrow
|
|
bind Left swap-window -t -1\; select-window -t -1
|
|
bind Right swap-window -t +1\; select-window -t +1
|
|
|
|
# Setting up pane resize with hjkl
|
|
bind -r j resize-pane -D 5
|
|
bind -r k resize-pane -U 5
|
|
bind -r l resize-pane -R 5
|
|
bind -r h resize-pane -L 5
|
|
|
|
# Setting up pane minimize/maximize with m
|
|
bind -r m resize-pane -Z
|
|
|
|
# Push tmux window/session info to the terminal title
|
|
set -g set-titles on
|
|
# omo-status puts a coloured marker (@omo_status) in front of the session name;
|
|
# focusing the tab clears the attention markers.
|
|
set -g set-titles-string "#{?@omo_status,#{@omo_status} ,}#{session_name}"
|
|
set-hook -g client-focus-in 'run-shell -b "~/.local/bin/omo-status focus #{q:hook_client}"'
|
|
# omo on a remote server reports its state in the title of a mosh or ssh pane
|
|
# ("omo:<state>:..."); omo-remote turns that into the same ding, marker and banner.
|
|
set-hook -g pane-title-changed 'if -F "#{&&:#{m:*omo:*,#{pane_title}},#{||:#{==:#{pane_current_command},mosh-client},#{==:#{pane_current_command},ssh}}}" "run-shell -b \"~/.local/bin/omo-remote title #{hook_pane}\""'
|
|
|
|
# Set plugin manager path before loading plugins
|
|
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins"
|
|
|
|
# List of plugins
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
|
|
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
|
|
set -g @plugin 'omerxx/catppuccin-tmux'
|
|
set -g @plugin 'omerxx/tmux-sessionx'
|
|
set -g @plugin 'omerxx/tmux-floax'
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
|
|
set -g @resurrect-dir "~/.tmux/resurrect"
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
|
|
|
|
set -g @sessionx-bind 's'
|
|
set -g @sessionx-window-mode 'on'
|
|
set -g @sessionx-tree-mode 'off'
|
|
set -g status-position top
|
|
|
|
set -g @catppuccin_window_left_separator ""
|
|
set -g @catppuccin_window_right_separator " "
|
|
set -g @catppuccin_window_middle_separator " █"
|
|
set -g @catppuccin_window_number_position "right"
|
|
set -g @catppuccin_window_default_fill "number"
|
|
set -g @catppuccin_window_default_text "#W"
|
|
set -g @catppuccin_window_current_fill "number"
|
|
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
|
|
set -g @catppuccin_status_modules_right "directory"
|
|
set -g @catppuccin_status_modules_left "session"
|
|
set -g @catppuccin_status_left_separator " "
|
|
set -g @catppuccin_status_right_separator " "
|
|
set -g @catppuccin_status_right_separator_inverse "no"
|
|
set -g @catppuccin_status_fill "icon"
|
|
set -g @catppuccin_status_connect_separator "no"
|
|
set -g @catppuccin_directory_text "#{b:pane_current_path}"
|
|
# set -g @catppuccin_date_time_text "%H:%M"
|
|
|
|
# for neovim
|
|
set -g @resurrect-strategy-nvim 'session'
|
|
set -g @continuum-restore 'on'
|
|
|
|
# Is VIM?
|
|
# TMUX Navigation
|
|
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf|pipenv)(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")'
|
|
|
|
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
|
|
|
|
|
|
# Clipboard (OSC 52)
|
|
# Required for nested tmux (local tmux -> ssh/mosh -> remote tmux): the inner
|
|
# tmux sends its copies up as OSC 52, and tmux only accepts OSC 52 coming
|
|
# from a pane when set-clipboard is "on". The default "external" drops it.
|
|
set -g set-clipboard on
|
|
set -as terminal-features ',*:clipboard'
|
|
|
|
# Ctrl+click a file path in any pane (omo, shell, logs) to open it:
|
|
# markdown in Markdown Preview, images/pdf/dirs in yazi, the rest in nvim.
|
|
# yazi and nvim split beside the clicked pane. See ~/.local/bin/tmux-open-path.
|
|
bind -n C-MouseDown1Pane run-shell -b "~/.local/bin/tmux-open-path #{q:pane_id} #{q:pane_current_path} #{mouse_x} #{q:mouse_line}"
|
|
|
|
#
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
run '~/.tmux/plugins/tpm/tpm'
|