200 lines
5.7 KiB
Plaintext
200 lines
5.7 KiB
Plaintext
# vim: ft=tmux
|
|
|
|
|
|
set -g prefix C-b
|
|
bind C-b send-prefix
|
|
|
|
|
|
# Toggle local tmux mappings to allow control remote tmux
|
|
bind -T root F12 {
|
|
set prefix None
|
|
set key-table off
|
|
set status off
|
|
}
|
|
|
|
bind -T off F12 {
|
|
set -u prefix
|
|
set -u key-table
|
|
set status on
|
|
}
|
|
|
|
bind WheelUpPane send-keys -N 2 scroll-up
|
|
bind WheelDownPane send-keys -N 2 scroll-Down
|
|
|
|
bind F12 send-keys F12
|
|
|
|
|
|
bind s choose-tree-index
|
|
|
|
|
|
# View current pane in editor
|
|
bind-key y {
|
|
capture-pane -J
|
|
save-buffer /tmp/tmux-buffer
|
|
delete-buffer
|
|
display-popup -E -w 90% -h 80% "nvim /tmp/tmux-buffer"
|
|
}
|
|
|
|
bind-key Y {
|
|
capture-pane -J -S - -E -
|
|
save-buffer /tmp/tmux-buffer
|
|
delete-buffer
|
|
display-popup -E -w 90% -h 80% "nvim /tmp/tmux-buffer"
|
|
}
|
|
|
|
bind t display-popup -E -h 70% -w 60%
|
|
bind c clock-mode
|
|
|
|
|
|
# Switch new session
|
|
bind n new-session -c ~
|
|
# Switch new named session
|
|
bind N command-prompt -p "New session:" "new-session -A -s '%1' -c ~"
|
|
|
|
|
|
bind x confirm-before -p "kill current session? (y/n)" "kill-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 C-x confirm-before -p "kill other sessions? (y/n)" "kill-session -a"
|
|
|
|
bind q confirm-before -p "kill current pane? (y/n)" "kill-pane"
|
|
bind Q kill-window
|
|
bind C-q confirm-before -p "kill other windows? (y/n)" "kill-window -a"
|
|
|
|
bind d detach
|
|
bind D choose-client -Z
|
|
bind C-d detach-other
|
|
|
|
bind r command-prompt -I '#W' -p "New window name:" "rename-window '%%'"
|
|
bind R command-prompt -I '#S' -p "New session name:" "rename-session '%%'"
|
|
|
|
|
|
bind ';' command-prompt
|
|
|
|
|
|
bind -n M-f toggle-zoom
|
|
|
|
|
|
bind l choose-window -w -Z 'link-window -s "%%" -a'
|
|
bind u unlink-window
|
|
|
|
bind j choose-window -Z 'join-pane -s "%%"'
|
|
|
|
|
|
bind Tab switch-client -l
|
|
|
|
|
|
bind F5 reload-config
|
|
|
|
|
|
# Panes navigation
|
|
bind -n M-h select-pane -L
|
|
bind -n M-l select-pane -R
|
|
bind -n M-j select-pane -D
|
|
bind -n M-k select-pane -U
|
|
|
|
|
|
# Resizing
|
|
bind -n C-M-l resize-pane -R
|
|
bind -n C-M-h resize-pane -L
|
|
bind -n C-M-j resize-pane -D
|
|
bind -n C-M-k resize-pane -U
|
|
|
|
|
|
# Swappings panes
|
|
bind -n M-L swap-pane -d -Z -t '{right-of}'
|
|
bind -n M-H swap-pane -d -Z -t '{left-of}'
|
|
bind -n M-J swap-pane -d -Z -t '{down-of}'
|
|
bind -n M-K swap-pane -d -Z -t '{up-of}'
|
|
|
|
|
|
# Sync panes
|
|
bind o toggle-synchronize-panes
|
|
bind O setw synchronize-panes off
|
|
|
|
|
|
bind i detect-panes
|
|
|
|
|
|
# Windows navigation
|
|
bind -n M-1 if-shell 'tmux select-window -t 1' '' 'new-window -t 1 -n 1 -c "#{pane_current_path}"'
|
|
bind -n M-2 if-shell 'tmux select-window -t 2' '' 'new-window -t 2 -n 2 -c "#{pane_current_path}"'
|
|
bind -n M-3 if-shell 'tmux select-window -t 3' '' 'new-window -t 3 -n 3 -c "#{pane_current_path}"'
|
|
bind -n M-4 if-shell 'tmux select-window -t 4' '' 'new-window -t 4 -n 4 -c "#{pane_current_path}"'
|
|
bind -n M-5 if-shell 'tmux select-window -t 5' '' 'new-window -t 5 -n 5 -c "#{pane_current_path}"'
|
|
bind -n M-6 if-shell 'tmux select-window -t 6' '' 'new-window -t 6 -n 6 -c "#{pane_current_path}"'
|
|
bind -n M-7 if-shell 'tmux select-window -t 7' '' 'new-window -t 7 -n 7 -c "#{pane_current_path}"'
|
|
bind -n M-8 if-shell 'tmux select-window -t 8' '' 'new-window -t 8 -n 8 -c "#{pane_current_path}"'
|
|
bind -n M-9 if-shell 'tmux select-window -t 9' '' 'new-window -t 9 -n 9 -c "#{pane_current_path}"'
|
|
bind -n M-0 if-shell 'tmux select-window -t 10' '' 'new-window -t 10 -n 10 -c "#{pane_current_path}"'
|
|
|
|
|
|
# Moving pane to window by Alt+Shift+Number
|
|
bind -n 'M-!' if-shell 'tmux join-pane -d -h -t :1' '' 'break-pane -t 1 -d -n 1'
|
|
bind -n 'M-@' if-shell 'tmux join-pane -d -h -t :2' '' 'break-pane -t 2 -d -n 2'
|
|
bind -n 'M-#' if-shell 'tmux join-pane -d -h -t :3' '' 'break-pane -t 3 -d -n 3'
|
|
bind -n 'M-$' if-shell 'tmux join-pane -d -h -t :4' '' 'break-pane -t 4 -d -n 4'
|
|
bind -n 'M-%' if-shell 'tmux join-pane -d -h -t :5' '' 'break-pane -t 5 -d -n 5'
|
|
bind -n 'M-^' if-shell 'tmux join-pane -d -h -t :6' '' 'break-pane -t 6 -d -n 6'
|
|
bind -n 'M-&' if-shell 'tmux join-pane -d -h -t :7' '' 'break-pane -t 7 -d -n 7'
|
|
bind -n 'M-*' if-shell 'tmux join-pane -d -h -t :8' '' 'break-pane -t 8 -d -n 8'
|
|
bind -n 'M-(' if-shell 'tmux join-pane -d -h -t :9' '' 'break-pane -t 9 -d -n 9'
|
|
bind -n 'M-)' if-shell 'tmux join-pane -d -h -t :10' '' 'break-pane -t 10 -d -n 10'
|
|
|
|
|
|
set -g main-pane-width '$_tmux_other_pane_size'
|
|
set -g main-pane-height '100%'
|
|
|
|
|
|
# Swapping windows
|
|
bind -r "<" swap-window -d -t -1
|
|
bind -r ">" swap-window -d -t +1
|
|
|
|
|
|
# Windows splitting
|
|
bind -n M-Enter split-window -d -h -b -l $_tmux_other_pane_size -c "#{pane_current_path}"
|
|
bind -n M-t split-window -v -l 20% -c "#{pane_current_path}"
|
|
bind \\ split-window -h -c "#{pane_current_path}"
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
|
|
|
|
bind -n M-q stash-pane
|
|
|
|
bind -n M-r default-layout
|
|
|
|
# Swap left pane
|
|
bind -n M-Tab swap-pane -t '{left-of}'
|
|
|
|
|
|
# Copy mode
|
|
setw -g mode-keys vi
|
|
bind v copy-mode
|
|
bind -n M-V copy-mode
|
|
bind -r p paste-buffer
|
|
bind C-p choose-buffer
|
|
|
|
## Toggle selection
|
|
bind -T copy-mode-vi v if -F '#{selection_active}' 'send-keys -X clear-selection' 'send-keys -X begin-selection'
|
|
|
|
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
|
|
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
|
|
|
|
bind -T copy-mode-vi Escape send-keys -X cancel
|
|
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
|
|
|
|
|
|
# Session managment
|
|
bind 1 run-shell ~/.tmux/01.sh
|
|
bind 2 run-shell ~/.tmux/02.sh
|
|
bind 3 run-shell ~/.tmux/03.sh
|
|
bind 4 run-shell ~/.tmux/04.sh
|
|
bind 5 run-shell ~/.tmux/05.sh
|
|
bind 6 run-shell ~/.tmux/06.sh
|
|
bind 7 run-shell ~/.tmux/07.sh
|
|
bind 8 run-shell ~/.tmux/08.sh
|
|
bind 9 run-shell ~/.tmux/09.sh
|
|
bind 0 run-shell ~/.tmux/10.sh |