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
tmux
window names to show connected remote hosts. - Ensures unique and clean concatenation of remote hostnames.
- Automatically restores the original
tmux
window name when nossh
sessions remain. - Works seamlessly with
oh-my-zsh
andzinit
plugin managers.
screencast.mp4
Using oh-my-zsh
-
Clone the repository into the
custom/plugins
directory: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
ssh
session insidetmux
, the plugin:- Captures the remote hostname of the session.
- Appends the hostname to the current
tmux
window name. - Ensures unique hostnames in the window name.
- When the
ssh
session ends:- The plugin removes the hostname from the
tmux
window name. - If no active
ssh
sessions remain, it restores the original window name.
- The plugin removes the hostname from the
-
Open a
tmux
session. -
Start an
ssh
session:ssh user@remote-host
The
tmux
window name updates to:remote-host
-
Open another pane and start a new
ssh
session:ssh user@another-host
The
tmux
window name updates to:remote-host+another-host
-
Exit one or both
ssh
sessions, 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.