tmux-remote
is a simple plugin that allows for toggling your tmux session's keybindings. This is especially useful when in nested remote tmux sessions that use the same prefix key as the host.
Tested and working macOS and Linux.
Install using tpm (tmux Plugin Manager)
By adding the following in your .tmux.conf
:
set -g @plugin 'danyim/tmux-remote'
Then hit prefix + I
to fetch the plugin and source it.
Clone the repo:
$ git clone https://github.com/danyim/tmux-remote
Add this line to the bottom of .tmux.conf
:
run-shell ~/path/to/tmux-remote/remote.tmux
Then reload your tmux environment with $ tmux source-file ~/.tmux.conf
.
After installing the plugin, simply press F12 to toggle remote-mode on and off.
Key | Action |
---|---|
F10 | Turns on remote mode |
F11 | Turns off remote mode |
F12 | Toggles the remote mode |
# Change the default on keybinding (F10)
setw -g @remote-on-key F10
# Change the default off keybinding (F11)
setw -g @remote-off-key F11
# Change the default toggle keybinding (F12)
setw -g @remote-toggle-key F12
Basic tests have been created with tmux-test. To run tests:
> ./run_tests
- Tmux in practice: local and nested remote tmux sessions Medium article by Alexey Samoshkin that inspired this plugin
- Nested tmux article by Dan Stahlke outlining the method for toggling keybindings