################ ### SETTINGS ### ################ set -g default-terminal "screen-256color" set -g base-index 1 setw -g pane-base-index 1 set -g default-shell "/etc/profiles/per-user/rayandrew/bin/fish" set -g status-keys vi set -g mode-keys vi set -g mouse on set -g focus-events off setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 set -g history-limit 2000 set-option -g detach-on-destroy off set-option -g status-position bottom # top set-option -g default-terminal 'xterm-256color' set-option -sa terminal-features ',xterm-kitty:RGB:extkeys' # set -g default-terminal "screen-256color" # set -ga terminal-overrides ",xterm-256color*:Tc" # https://github.com/folke/tokyonight.nvim#making-undercurls-work-properly-in-tmux set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' setw -g automatic-rename on # rename window to reflect current program set -g renumber-windows on # renumber windows when a window is closed set -g set-titles on # set terminal title set -g display-panes-time 800 # slightly longer pane indicators display time set -g display-time 1000 # slightly longer status messages display time # activity set -g monitor-activity on set -g visual-activity off set -gq allow-passthrough on set -g detach-on-destroy off ################ ### BINDINGS ### ################ # rebind main key: C-Space unbind C-b set -g prefix C-Space bind -n -N "Send the prefix key through to the application" \ C-Space send-prefix # bind -n C-l send-keys C-l \; run 'sleep 1.1' \; clear-history bind C-c command-prompt -p "New Session:" "new-session -A -s '%%'" # create session bind C-k confirm kill-session # kill session # bind r source-file /Users/rayandrew/.config/tmux/tmux.conf # reload tmux conf bind C-f command-prompt -p find-session 'switch-client -t %%' # find session bind c new-window -c "#{pane_current_path}" # create new window bind - split-window -v -c "#{pane_current_path}" # split current window horizontally bind _ split-window -h -c "#{pane_current_path}" # split current window vertically bind-key x kill-pane # Sessions bind -N "switch to root session (via sesh) " 9 run-shell "sesh connect --root $(pwd)" bind-key "R" display-popup -E -w 40% "sesh connect \"$( sesh list -i -H | gum filter --value \"$(sesh root)\" --limit 1 --fuzzy --no-sort --placeholder 'Pick a sesh' --prompt='⚡ 'readme --no-strip-ansi )\"" bind -N "last-session (via sesh) " l run-shell "sesh last" bind-key "t" display-popup -E -w 40% "sesh connect \"$( sesh list --icons | gum filter --limit 1 --placeholder 'Pick a sesh' --prompt='⚡ ' --no-strip-ansi )\"" bind-key "T" run-shell "sesh connect \"$( sesh list --icons | fzf-tmux -p 80%,70% \ --no-sort --ansi --border-label ' sesh ' --prompt '⚡ ' \ --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ --bind 'tab:down,btab:up' \ --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \ --bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \ --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \ --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \ --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \ --preview-window 'right:55%' \ --preview 'sesh preview {}' )\"" # pane navigation # bind -r h select-pane -L # move left # bind -r j select-pane -D # move down # bind -r k select-pane -U # move up # bind -r l select-pane -R # move right bind > swap-pane -D # swap current pane with the next one bind < swap-pane -U # swap current pane with the previous one # pane resizing bind -r H resize-pane -L 2 bind -r J resize-pane -D 2 bind -r K resize-pane -U 2 bind -r L resize-pane -R 2 # window navigation unbind n unbind p bind -r C-h previous-window # select previous window bind -r C-l next-window # select next window bind Tab last-window # move to last active window # copy mode set -g set-clipboard on bind Enter copy-mode # enter copy mode run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' # run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" 2> /dev/null || true' run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true' run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' # copy to X11 clipboard if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' # copy to macOS clipboard if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' # copy to Windows clipboard if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' # status line set -g status "on" set -g status-justify "left" set -g status-left-length "100" set -g status-right-length "100" set -g status-left-style NONE set -g status-right-style NONE # set -g status-style bg=default set -g status-right "#H" # set -g status-interval 10 # redraw status line every 10 seconds # https://github.com/christoomey/vim-tmux-navigator # disable wrapping is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" bind-key -n 'C-h' if-shell "$is_vim" { send-keys C-h } { if-shell -F '#{pane_at_left}' {} { select-pane -L } } bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } } bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } } bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } } bind-key -T copy-mode-vi 'C-h' if-shell -F '#{pane_at_left}' {} { select-pane -L } bind-key -T copy-mode-vi 'C-j' if-shell -F '#{pane_at_bottom}' {} { select-pane -D } bind-key -T copy-mode-vi 'C-k' if-shell -F '#{pane_at_top}' {} { select-pane -U } bind-key -T copy-mode-vi 'C-l' if-shell -F '#{pane_at_right}' {} { select-pane -R }