116 lines
3.6 KiB
Bash
116 lines
3.6 KiB
Bash
## Base Config
|
|
|
|
set-option -sa terminal-overrides ",xterm*:Tc"
|
|
# set -g default-terminal "screen-256color"
|
|
set -g mouse on
|
|
set -g history-limit 100000
|
|
set -g base-index 1 # start windows in 1
|
|
set-window-option -g pane-base-index 1
|
|
set-window-option -g mode-keys vi
|
|
unbind -T copy-mode-vi Space; #Default for begin-selection
|
|
unbind -T copy-mode-vi Enter; #Default for copy-selection
|
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
|
|
# set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
|
|
set -sg escape-time 0
|
|
set-option -g focus-events on
|
|
set-option -g renumber-windows on
|
|
set -g detach-on-destroy off # don't exit from tmux when closing a session
|
|
|
|
# Yazi need this config to show image preview
|
|
set -g allow-passthrough on
|
|
set -ga update-environment TERM
|
|
set -ga update-environment TERM_PROGRAM
|
|
|
|
## Keybindings
|
|
unbind C-b
|
|
unbind C-Space
|
|
set -g prefix C-Space
|
|
|
|
# Reload Config
|
|
unbind R
|
|
bind R source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
|
|
|
|
# Copy Mode
|
|
unbind [
|
|
bind V copy-mode
|
|
|
|
# Panes
|
|
unbind v
|
|
unbind s
|
|
unbind D
|
|
unbind % # Split vertically
|
|
unbind '"' # Split horizontally
|
|
|
|
bind s split-window -h -c "#{pane_current_path}"
|
|
bind v split-window -v -c "#{pane_current_path}"
|
|
bind D kill-pane
|
|
|
|
bind-key C-Space if-shell -F '#{==:#{session_name},scratch}' {
|
|
detach-client
|
|
} {
|
|
display-popup -w '80%' -h '80%' -d "#{pane_current_path}" -E "tmux new-session -A -s scratch"
|
|
}
|
|
|
|
bind -r m resize-pane -Z # maximize pane
|
|
|
|
bind-key M choose-window -Nwf"##{==:##{session_name},#{session_name}}" "join-pane -h -t '%%'" # Send pane to window
|
|
bind-key N break-pane # send current pane to new window
|
|
bind-key S command-prompt -p "Swap window with:" "swap-window -d -t '%%'" # send current pane to new window
|
|
|
|
# Windows
|
|
unbind r
|
|
unbind n
|
|
unbind h
|
|
unbind l
|
|
|
|
bind r command-prompt "rename-window '%%'"
|
|
bind n new-window -c "#{pane_current_path}"
|
|
bind h previous-window
|
|
bind l next-window
|
|
|
|
# set -g status-right '#(bartib current | sed -n 3p | awk \'{print $NF}\')'
|
|
|
|
## Plugins
|
|
|
|
## Auto install plugins
|
|
if "test ! -d ~/.config/tmux/plugins/tpm" \
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
run -b '~/.config/tmux/plugins/tpm/tpm'
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
set -g @plugin 'catppuccin/tmux'
|
|
# set -g @plugin 'rwxd/catppuccin-tmux'
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-copycat'`
|
|
set -g @plugin 'laktak/extrakto'
|
|
set -g @plugin 'christoomey/vim-tmux-navigator'
|
|
set -g @plugin 'sainnhe/tmux-fzf'
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
|
|
|
|
## Plugin Config
|
|
set -g @catppuccin_flavour 'macchiato'
|
|
set -g @catppuccin_window_tabs_enabled off # or off to disable window_tabs
|
|
set -g @catppuccin_status_modules_right "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_window_default_text "#{?window_zoomed_flag, ,}#W"
|
|
set -g @catppuccin_window_current_text "#{?window_zoomed_flag, ,}#W"
|
|
set -g @continuum-restore 'on'
|
|
set -g @resurrect-processes 'vi vim nvim man "~pnpm dev->pnpm dev *"'
|
|
|
|
TMUX_FZF_LAUNCH_KEY="w"
|
|
TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m"
|
|
|
|
|
|
# Tmux Management
|
|
bind-key "f" run-shell "~/.local/share/chezmoi/scripts/fzf-tmux-sessions"
|
|
|
|
bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
|
|
# bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/window.sh switch"
|