From a785cec3c20976c310a7c741150247d31341d6a2 Mon Sep 17 00:00:00 2001 From: Adrien Luxey Date: Sat, 25 Jan 2020 21:51:35 +0100 Subject: [PATCH] Added keystrokes listening toggle button for nested tmux sessions --- tmux.conf | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tmux.conf b/tmux.conf index dd7a9e2..2b05946 100644 --- a/tmux.conf +++ b/tmux.conf @@ -31,10 +31,10 @@ set -g @continuum-save-interval '15' # save time in minutes # Copy to system clipboard # Normal mode: -# Prefix + y => (yank) Copies text from command line to clipboard +# Prefix + y => (yank) Copies text from command line to clipboard # Copy mode: -# y => copy selection to clipboard -# Y => Put (copy a selection then paste it to cmd) +# y => copy selection to clipboard +# Y => Put (copy a selection then paste it to cmd) set -g @plugin 'tmux-plugins/tmux-yank' # There seems to be cool things to make Vim and Tmux play well together too @@ -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 ###