Added keystrokes listening toggle button for nested tmux sessions

This commit is contained in:
Adrien Luxey 2020-01-25 21:51:35 +01:00
parent 71087cf9ff
commit a785cec3c2

View file

@ -44,6 +44,9 @@ set -g @plugin 'tmux-plugins/tmux-yank'
### Adrien's stuff ###
#######################
# Set the display duration of message (in ms)
set-option -g display-time 2000
# Make tmux display true colors
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
@ -52,6 +55,28 @@ set -ga terminal-overrides ",*256col*:Tc"
bind % split-window -h -c '#{pane_current_path}' # Split panes horizontally
bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
# A big-ass history
set -g history-limit 10000
#####################################################
# Simple nested tmux sessions (e.g. remote and local)
# F10 toggles tmux listening for keystrokes, allowing to switch betwen remote and local
# https://www.freecodecamp.org/news/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795/
bind -T root F10 \
set prefix None \;\
set key-table off \;\
display-message "Discarding keystrokes."\;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S
bind -T off F10 \
set -u prefix \;\
set -u key-table \;\
display-message "Listening to keystrokes."\;\
refresh-client -S
#####################################################
# Notes :
# prefix ~ --> show-messages (see previous messages)
#####################
### Alex's stuff ###