Synchronize your tmux window names with active ssh sessions. This plugin dynamically updates the tmux window name to reflect the remote hosts of active ssh sessions in the same window. It also restores the original window name when all ssh sessions are closed.
- Dynamically updates
tmuxwindow names to show connected remote hosts. - Ensures unique and clean concatenation of remote hostnames.
- Automatically restores the original
tmuxwindow name when nosshsessions remain. - Automatically restores the original cursor style after an
sshsession - Works seamlessly with
oh-my-zshandzinitplugin managers.
screencast.mp4
Using oh-my-zsh
-
Clone the repository into the
custom/pluginsdirectory:git clone https://github.com/alberti42/tmux-ssh-syncing.git $ZSH_CUSTOM/plugins/tmux-ssh-syncing -
Add the plugin to your
.zshrc:plugins=(... tmux-ssh-syncing) -
Restart your terminal or reload your shell:
source ~/.zshrc
Using zinit
-
Add the following to your
.zshrc:zinit ice lucid wait zinit light alberti42/tmux-ssh-syncing -
Restart your terminal or reload your shell:
source ~/.zshrc
- When you start an
sshsession insidetmux, the plugin:- Captures the remote hostname of the session.
- Appends the hostname to the current
tmuxwindow name. - Ensures unique hostnames in the window name.
- When the
sshsession ends:- The plugin removes the hostname from the
tmuxwindow name. - If no active
sshsessions remain, it restores the original window name.
- The plugin removes the hostname from the
-
Open a
tmuxsession. -
Start an
sshsession:ssh user@remote-hostThe
tmuxwindow name updates to:remote-host -
Open another pane and start a new
sshsession:ssh user@another-hostThe
tmuxwindow name updates to:remote-host+another-host -
Exit one or both
sshsessions, and the window name dynamically adjusts or restores to its original name.
This project is licensed under the MIT License. See the LICENSE file for details.