diff --git a/home/user/.config/tmux/mappings.conf b/home/user/.config/tmux/mappings.conf index 5c28421..3a1bb8e 100644 --- a/home/user/.config/tmux/mappings.conf +++ b/home/user/.config/tmux/mappings.conf @@ -30,15 +30,16 @@ bind n command-prompt -p "New session:" "new-session -A -d -s '%1' -c ~ \; switc # Kill last session bind X confirm-before -p "kill last session [#{client_last_session}]? (y/n)" "kill-session -t #{client_last_session} \; display-message \"Killed last session\"" - # Kill session and reattach to last session bind x confirm-before -p "kill current session? (y/n)" "switch-client -l \; kill-session -t '#S'" -# Kill other windows -bind C-x confirm-before -p "kill other windows? (y/n)" "kill-window -a" - # kill pane -bind k confirm-before -p "kill current pane? (y/n)" "kill-pane" +bind q confirm-before -p "kill current pane? (y/n)" "kill-pane" +# kill window +bind Q confirm-before -p "kill current window? (y/n)" "kill-window" + +# Kill other windows +bind C-q confirm-before -p "kill other windows? (y/n)" "kill-window -a" # SSH Session @@ -56,7 +57,7 @@ bind -n M-f resize-pane -Z # Link window bind L command-prompt -p "Link window from (session:window):" "link-window -s %% -a" -# Link pane +# Join pane bind C-l command-prompt -p "Join pane from (session:window.pane):" "join-pane -s %%" @@ -76,11 +77,18 @@ bind -n M-j select-pane -D bind -n M-k select-pane -U + # Sync panes -bind o setw synchronize-panes on +bind o if -F '#{pane_synchronized}' 'setw synchronize-panes off' 'setw synchronize-panes on' bind O setw synchronize-panes off +# Detach +bind D if -F '#{session_many_attached}' \ + 'confirm-before -p "Detach other clients? (y/n)" "detach -a"' \ + 'display "Session has only 1 client attached"' + + # Windows navigation bind -n M-p previous-window bind -n M-n next-window @@ -129,8 +137,8 @@ bind -T copy-mode-vi C-c send-keys -X cancel bind -T copy-mode-vi q send-keys -X cancel -bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up -bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down +bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up +bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down # Session managment diff --git a/home/user/.config/tmux/options.conf b/home/user/.config/tmux/options.conf index 9b62b53..b1610d7 100644 --- a/home/user/.config/tmux/options.conf +++ b/home/user/.config/tmux/options.conf @@ -23,6 +23,7 @@ set -g default-terminal "xterm-256color" set -ga terminal-overrides ",xterm-256color:Tc" set-hook -g after-new-window[101] 'rename-window -t 1 1' +set-hook -g after-new-session[101] 'rename-window -t 1 1' set -ga update-environment 'DISPLAY' set -ga update-environment 'WINDOWID'