feat(tmux): mappings

This commit is contained in:
thek4n 2024-05-13 11:33:44 +03:00
parent 4cdccc56c5
commit 1c0dfeb470
2 changed files with 18 additions and 9 deletions

View File

@ -30,15 +30,16 @@ bind n command-prompt -p "New session:" "new-session -A -d -s '%1' -c ~ \; switc
# Kill last session # 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\"" 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 # Kill session and reattach to last session
bind x confirm-before -p "kill current session? (y/n)" "switch-client -l \; kill-session -t '#S'" 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 # 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 # SSH Session
@ -56,7 +57,7 @@ bind -n M-f resize-pane -Z
# Link window # Link window
bind L command-prompt -p "Link window from (session:window):" "link-window -s %% -a" 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 %%" 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 bind -n M-k select-pane -U
# Sync panes # 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 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 # Windows navigation
bind -n M-p previous-window bind -n M-p previous-window
bind -n M-n next-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 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 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 WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
# Session managment # Session managment

View File

@ -23,6 +23,7 @@ set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc" set -ga terminal-overrides ",xterm-256color:Tc"
set-hook -g after-new-window[101] 'rename-window -t 1 1' 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 'DISPLAY'
set -ga update-environment 'WINDOWID' set -ga update-environment 'WINDOWID'