🔧 chore(tmux): Tweak tmux config

This commit is contained in:
punkfairie 2024-03-03 14:29:11 -08:00
parent bd1a1a6688
commit fce9a40f97
Signed by: punkfairie
GPG key ID: A86AF57F837E320F

View file

@ -35,43 +35,42 @@ unbind C-b
set-option -g prefix C-a
bind C-a send-prefix
# Vi copy mode.
setw -g mode-keys vi
unbind [
bind -N 'Enter normal (copy) mode' Escape copy-mode # cmd-esc on macOS
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
# Easy reload config.
bind r source-file ~/.tmux.conf \; display-message "Reloaded ~/.tmux.conf"
# Better split commands.
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
bind -N 'vsplit' | split-window -h -c "#{pane_current_path}"
bind -N 'vsplit' \\ split-window -h -c "#{pane_current_path}"
bind -N 'hsplit' - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# 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
bind -N 'Switch to pane (left)' h select-pane -L
bind -N 'Switch to pane (down)' j select-pane -D
bind -N 'Switch to pane (up)' k select-pane -U
bind -N 'Switch to pane (right)' l select-pane -R
# Vi-like resizing.
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 -r -N 'Resize pane (left)' M-h resize-pane -L 5
bind -r -N 'Resize pane (down)' M-j resize-pane -D 5
bind -r -N 'Resize pane (up)' M-k resize-pane -U 5
bind -r -N 'Resize pane (right)' M-l resize-pane -R 5
bind -N 'Previous window' Left previous-window # cmd-left on macOS
bind -N 'Next window' Right next-window # cmd-right on macOS
# Even out panes.
bind -N 'Evenly distribute panes' = select-layout -E
# Easy reload config.
bind r source-file ~/.tmux.conf # cmd-r on macOS
# Swap panes.
bind -r -N 'Swap current pane with the next' H swap-pane -U
bind -r -N 'Swap current pane with the previous' L swap-pane -D
# Window switching.
bind -N 'Previous window' Left previous-window
bind -N 'Next window' Right next-window
# Popup.
unbind i
bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on macOS
bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' {
detach-client
} {
if-shell "tmux has-session -t scratch" {
@ -81,6 +80,19 @@ bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on
}
}
# Vi copy mode.
setw -g mode-keys vi
set -g set-clipboard external
unbind [
bind -N 'Enter normal (copy) mode' Escape copy-mode
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
################################################################################
# Catppuccin #
################################################################################
@ -88,19 +100,23 @@ bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on
# catppuccin
set -g @catppuccin_flavour 'macchiato'
set -g @catppuccin_window_left_separator "█"
set -g @catppuccin_window_right_separator "█ "
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_middle_separator " █"
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 "#{command}"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "application user host session date_time"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"
set -g @catppuccin_status_modules_right "directory user host 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 "#{pane_current_path}"
set -g @catppuccin_date_time_text "%b %d • %I:%M %p"