2024-02-03 12:36:54 -08:00
|
|
|
################################################################################
|
|
|
|
# Plugins #
|
|
|
|
################################################################################
|
|
|
|
|
2024-01-28 11:55:11 -08:00
|
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
|
|
set -g @plugin 'catppuccin/tmux'
|
2024-01-28 19:07:02 -08:00
|
|
|
|
2024-02-03 12:36:54 -08:00
|
|
|
################################################################################
|
|
|
|
# General #
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Make window index start at 1.
|
|
|
|
set -g base-index 1
|
|
|
|
|
|
|
|
# Make pane index start at 1.
|
|
|
|
setw -g pane-base-index 1
|
|
|
|
|
2024-02-05 18:10:41 -08:00
|
|
|
# Automatically renumber windows when one is deleted.
|
|
|
|
set -g renumber-windows on
|
|
|
|
|
2024-02-06 20:24:37 -08:00
|
|
|
set -g default-terminal "xterm-256color"
|
2024-02-06 18:53:32 -08:00
|
|
|
set -ag terminal-overrides ",*:RGB"
|
2024-02-03 12:36:54 -08:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Key Mappings #
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Remap prefix.
|
|
|
|
unbind C-b
|
|
|
|
set-option -g prefix C-a
|
|
|
|
bind C-a send-prefix
|
|
|
|
|
|
|
|
# Vi copy mode.
|
|
|
|
setw -g mode-keys vi
|
|
|
|
unbind [
|
2024-02-05 22:00:46 -08:00
|
|
|
bind -N 'Enter normal (copy) mode' Escape copy-mode # cmd-esc on macOS
|
2024-02-03 12:36:54 -08:00
|
|
|
unbind p
|
|
|
|
bind p paste-buffer
|
|
|
|
bind -T copy-mode-vi 'v' send -X begin-selection
|
|
|
|
bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
|
|
|
|
|
|
|
# Better split commands.
|
2024-02-05 22:00:46 -08:00
|
|
|
bind -N 'vsplit' | split-window -h -c "#{pane_current_path}" # cmd-| on macOS
|
|
|
|
bind -N 'vsplit' \\ split-window -h -c "#{pane_current_path}" # cmd-\ on macOS
|
|
|
|
bind -N 'hsplit' - split-window -v -c "#{pane_current_path}" # cmd-- on macOS
|
2024-02-03 12:36:54 -08:00
|
|
|
unbind '"'
|
|
|
|
unbind %
|
|
|
|
|
2024-02-05 22:00:46 -08:00
|
|
|
# Vi-like pane switching.
|
|
|
|
bind -N 'Switch to pane (left)' h select-pane -L # cmd-h on macOS
|
|
|
|
bind -N 'Switch to pane (down)' j select-pane -D # cmd-j on macOS
|
|
|
|
bind -N 'Switch to pane (up)' k select-pane -U # cmd-k on macOS
|
|
|
|
bind -N 'Switch to pane (right)' l select-pane -R # cmd-l on macOS
|
|
|
|
|
2024-02-03 12:36:54 -08:00
|
|
|
# Vi-like resizing.
|
2024-02-05 22:00:46 -08:00
|
|
|
bind -N 'Resize pane (left)' M-h resize-pane -L # cmd-opt-h on macOS
|
|
|
|
bind -N 'Resize pane (down)' M-j resize-pane -D # cmd-opt-j on macOS
|
|
|
|
bind -N 'Resize pane (up)' M-k resize-pane -U # cmd-opt-k on macOS
|
|
|
|
bind -N 'Resize pane (right)' M-l resize-pane -R # cmd-opt-l on macOS
|
|
|
|
|
|
|
|
bind -N 'Previous window' Left previous-window # cmd-left on macOS
|
|
|
|
bind -N 'Next window' Right next-window # cmd-right on macOS
|
2024-02-03 12:36:54 -08:00
|
|
|
|
|
|
|
# Easy reload config.
|
2024-02-05 22:00:46 -08:00
|
|
|
bind r source-file ~/.tmux.conf # cmd-r on macOS
|
2024-02-03 12:36:54 -08:00
|
|
|
|
2024-02-05 18:10:41 -08:00
|
|
|
# Popup.
|
|
|
|
unbind i
|
2024-02-05 22:00:46 -08:00
|
|
|
bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on macOS
|
2024-02-05 18:10:41 -08:00
|
|
|
detach-client
|
|
|
|
} {
|
|
|
|
if-shell "tmux has-session -t scratch" {
|
|
|
|
display-popup -E -h 90% -w 90% "tmux attach-session -t scratch"
|
|
|
|
} {
|
|
|
|
display-popup -E -h 90% -w 90% "tmux new-session -d -c '#{pane_current_path}' -s scratch && tmux set-option -t scratch status off && tmux attach-session -t scratch"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-03 12:36:54 -08:00
|
|
|
################################################################################
|
|
|
|
# Catppuccin #
|
|
|
|
################################################################################
|
2024-01-28 19:07:02 -08:00
|
|
|
|
2024-01-28 14:59:27 -08:00
|
|
|
# catppuccin
|
2024-01-28 11:55:11 -08:00
|
|
|
set -g @catppuccin_flavour 'mocha'
|
|
|
|
|
2024-02-06 21:24:41 -08:00
|
|
|
set -g @catppuccin_window_left_separator "█"
|
|
|
|
set -g @catppuccin_window_right_separator "█ "
|
|
|
|
set -g @catppuccin_window_number_position "right"
|
|
|
|
set -g @catppuccin_window_middle_separator " █"
|
2024-01-28 11:55:11 -08:00
|
|
|
|
|
|
|
set -g @catppuccin_window_default_fill "number"
|
|
|
|
|
|
|
|
set -g @catppuccin_window_current_fill "number"
|
2024-02-06 21:24:41 -08:00
|
|
|
set -g @catppuccin_window_current_text "#{pane_current_path}"
|
|
|
|
|
|
|
|
set -g @catppuccin_status_modules_right "application user host session date_time"
|
|
|
|
set -g @catppuccin_status_left_separator "█"
|
|
|
|
set -g @catppuccin_status_right_separator "█"
|
2024-01-28 11:55:11 -08:00
|
|
|
|
|
|
|
set -g @catppuccin_directory_text "#{pane_current_path}"
|
2024-01-28 19:32:30 -08:00
|
|
|
set -g @catppuccin_date_time_text "%b %d • %I:%M %p"
|
2024-01-28 11:55:11 -08:00
|
|
|
|
2024-02-03 12:36:54 -08:00
|
|
|
################################################################################
|
|
|
|
# tpm #
|
|
|
|
################################################################################
|
2024-01-28 14:59:27 -08:00
|
|
|
|
2024-01-28 11:55:11 -08:00
|
|
|
# Install tpm if not already installed.
|
|
|
|
if "test ! -d ~/.tmux/plugins/tpm" \
|
|
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
|
|
|
|
# Init tmux plugin manager.
|
|
|
|
# Must be very last line!!
|
|
|
|
run '~/.tmux/plugins/tpm/tpm'
|