From 6069b701f3ae9b80c83c6d72b6d01d6d33bf23b7 Mon Sep 17 00:00:00 2001 From: Charles Danesi Date: Sun, 1 Dec 2024 10:04:03 -0500 Subject: [PATCH] feat: add more keybinds for navigation fix session restore asking to name all windows again --- .config/tmux/tmux.conf | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 0ceb921..5a6a89f 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,8 +1,19 @@ # ~/.config/tmux/tmux.conf +# ┌ +# │ NOTE: $KITTY_LISTEN_ON is not being updated no matter +# │ how I try +# │ unless the server is killed and restarted. +# │ On macOS, I accidentally Cmd+Q often and therefore lose +# │ the socket +# └ +set -g update-environment -r +setenv -g KITTY_LISTEN_ON $KITTY_LISTEN_ON +set -ag update-environment 'KITTY_LISTEN_ON' + set -g escape-time 0 -set -g default-terminal "tmux-256color" -set -ag terminal-overrides ",xterm-256color:RGB" +set -g default-terminal "xterm-256color" +set -ag terminal-overrides ",xterm-256color:Tc,xterm-kitty:Tc,alacritty:Tc" set -g history-limit 150000 set -g display-time 2500 set -g status-interval 5 @@ -11,23 +22,27 @@ set -g status-position top # Start indexes at 1 instead of 0 set -g base-index 1 -setw -g pane-base-index 1 +set -g pane-base-index 1 set -g renumber-windows on # Set term title to current session window set -g set-titles on set -g set-titles-string "#I: #W" +setw -g automatic-rename off +set -g allow-rename off + # Change prefix from ctrl+b to ctrl+a set -g prefix C-a unbind C-b -bind-key C-a send-prefix +# nested session handling? +bind-key C-a last-window #send-prefix +bind-key a send-prefix # Split windows with | and - unbind % -bind-key -N "Add a new pane to the right of the currently active pane" | split-window -h -c "#{pane_current_path}" - unbind '"' +bind-key -N "Add a new pane to the right of the currently active pane" | split-window -h -c "#{pane_current_path}" bind-key -N "Add a new pane under the currently active pane" - split-window -v -c "#{pane_current_path}" # Reload config @@ -49,20 +64,23 @@ bind-key -N "Resize pane down" -r j resize-pane -D 5 bind-key -N "Resize pane up" -r k resize-pane -U 5 bind-key -N "Resize pane right" -r l resize-pane -R 5 +# window layout +bind-key -N "Cycle window layout" enter next-layout +bind-key -N "Rotate panes clockwise around window" -n C-o rotate-window + # Fullscreen current pane bind-key -N "Zoom current pane (fill window)" -r m resize-pane -Z + # create new windows in the same cwd bind-key -N "Create a new window within CWD" c new-window -c "#{pane_current_path}" +# Prompt to rename new windows on creation +# set-hook -g after-new-window 'command-prompt -I "#{window_pane}" "rename-window '%%'"' + # Window navigation bind-key -N "Move to previous window" -n C-p previous-window bind-key -N "Move to next window" -n C-n next-window -# Prompt to rename new windows on creation -set-hook -g after-new-window 'command-prompt -I "#{window_pane}" "rename-window '%%'"' - -set -g mouse on - setw -g mode-keys vi setw -g status-keys vi @@ -72,6 +90,7 @@ unbind -T copy-mode-vi Enter; bind-key -N "Begin selection" -T copy-mode-vi 'v' send -X begin-selection bind-key -N "Copy selection to buffer" -T copy-mode-vi 'y' send -X copy-selection +set -g mouse on unbind -T copy-mode-vi MouseDragEnd1Pane ##########################