123 lines
3.1 KiB
Plaintext
123 lines
3.1 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
|
|
|
|
## Toggle remote tmux mappings
|
|
bind F12 send-keys F12
|
|
|
|
|
|
# Choose session with key index starting from 1
|
|
bind s choose-tree -ZsK '#{?#{e|<:#{line},9},#{e|+:1,#{line}},#{?#{e|<:#{line},35},M-#{a:#{e|+:97,#{e|-:#{line},9}}},}}'
|
|
|
|
|
|
# Switch new named session
|
|
bind n command-prompt -p "New session:" "new-session -A -d -s '%1' -c ~ \; switch-client -t '%1'"
|
|
|
|
|
|
# Kill session and reattach to last session
|
|
bind k confirm-before -p "kill current session? (y/n)" "switch-client -l \; kill-session -t '#S'"
|
|
|
|
|
|
# SSH Session
|
|
bind h command-prompt -p "Remote host:" "new-session -n 1 -s 'ssh-%1' -A ssh %1"
|
|
|
|
|
|
# Call prompt via prefix ;
|
|
bind ';' command-prompt
|
|
|
|
|
|
# Zoom pane
|
|
bind -n M-f resize-pane -Z
|
|
|
|
|
|
# Lock screen
|
|
bind l confirm-before -p "lock tmux? (y/n)" lock-session
|
|
|
|
|
|
# Reload config
|
|
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..."
|
|
|
|
|
|
# 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
|
|
|
|
|
|
# Windows navigation
|
|
bind -n M-p previous-window
|
|
bind -n M-n next-window
|
|
bind -n M-Tab last-window
|
|
|
|
bind -n M-1 new-window -n 1 -S -c "#{pane_current_path}"
|
|
bind -n M-2 new-window -n 2 -S -c "#{pane_current_path}"
|
|
bind -n M-3 new-window -n 3 -S -c "#{pane_current_path}"
|
|
bind -n M-4 new-window -n 4 -S -c "#{pane_current_path}"
|
|
bind -n M-5 new-window -n 5 -S -c "#{pane_current_path}"
|
|
bind -n M-6 new-window -n 6 -S -c "#{pane_current_path}"
|
|
bind -n M-7 new-window -n 7 -S -c "#{pane_current_path}"
|
|
bind -n M-8 new-window -n 8 -S -c "#{pane_current_path}"
|
|
bind -n M-9 new-window -n 9 -S -c "#{pane_current_path}"
|
|
bind -n M-0 new-window -n 10 -S -c "#{pane_current_path}"
|
|
|
|
|
|
# Windows splitting
|
|
bind -n M-Enter split-window -h -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}"
|
|
|
|
|
|
# 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
|
|
|
|
|
|
# Copy mode
|
|
setw -g mode-keys vi
|
|
bind v copy-mode
|
|
bind p paste-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
|
|
|
|
|
|
# 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
|
|
|
|
|
|
# Switch to last session
|
|
bind Tab switch-client -l |