From b147ba4035a1982cf99db41fee423b66af14e65b Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:48:01 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore:=20Add=20tmux=20conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tmux.conf | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 .tmux.conf diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..ac55d1d --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,118 @@ +################################################################################ +# Plugins # +################################################################################ + +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' + +################################################################################ +# General # +################################################################################ + +# Set shell to fish. +set -g default-shell /bin/fish + +# Make window index start at 1. +set -g base-index 1 + +# Make pane index start at 1. +setw -g pane-base-index 1 + +# Automatically renumber windows when one is deleted. +set -g renumber-windows on + +set -g default-terminal "xterm-256color" +set -ag terminal-overrides ",*:RGB" + +################################################################################ +# 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 [ +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 + +# 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 +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 + +# 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 -N 'Previous window' Left previous-window # cmd-left on macOS +bind -N 'Next window' Right next-window # cmd-right on macOS + +# Easy reload config. +bind r source-file ~/.tmux.conf # cmd-r on macOS + +# Popup. +unbind i +bind -N 'Popup shell' i if-shell -F '#{==:#{session_name},scratch}' { # cmd-i on macOS + 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" + } +} + +################################################################################ +# Catppuccin # +################################################################################ + +# catppuccin +set -g @catppuccin_flavour 'macchiato' + +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 " █" + +set -g @catppuccin_window_default_fill "number" + +set -g @catppuccin_window_current_fill "number" +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 "█" + +set -g @catppuccin_directory_text "#{pane_current_path}" +set -g @catppuccin_date_time_text "%b %d • %I:%M %p" + +################################################################################ +# tpm # +################################################################################ + +# 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'