Get support for soyuka/tmux-current-pane-hostname
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
soyuka/tmux-current-pane-hostname
Tmux current pane hostname/user
Tmux plugin that enables displaying hostname and user of the current pane in your status bar.
Replaces the #H
format and adds a #U
format option.
Usage
-
#H
will be the hostname of your current path. If there is an ssh session opened, the ssh hostname will show instead of the local one. -
#{hostname_short}
will be the short hostname of your current path (up to the first dot). If there is an ssh session opened, the ssh hostname will show instead of the local one. -
#U
will show thewhoami
result or the user that logged in an ssh session. -
#{pane_ssh_port}
if an open ssh session will show the connection port, otherwise it will be empty. -
#{pane_ssh_connected}
will be set to 1 if the currently selected pane has an active ssh connection. (Useful for#{?#{pane_ssh_connected},ssh,no-ssh}
which will evaluate tossh
if there is an active ssh in the currently selected pane andno-ssh
otherwise.)
Here's the example in .tmux.conf
:
set -g status-right '#[fg=cyan,bold] #U@#H #[default]#[fg=blue]#(tmux display-message -p "#{pane_current_path}" | sed "s#$HOME#~#g") #[fg=red]%H:%M %d-%b-%y#[default]'
Installation with Tmux Plugin Manager (recommended)
Add plugin to the list of TPM plugins in .tmux.conf
:
set -g @tpm_plugins " \
tmux-plugins/tpm \
soyuka/tmux-current-pane-hostname \
"
Hit prefix + I
to fetch the plugin and source it.
#U@#H
interpolation should now take the current pane ssh status into consideration.
Manual Installation
Clone the repo:
$ git clone https://github.com/soyuka/tmux-current-pane-hostname ~/clone/path
Add this line to the bottom of .tmux.conf
:
run-shell ~/clone/path/current_pane_hostname.tmux
Reload TMUX environment:
# type this in terminal
$ tmux source-file ~/.tmux.conf
#U@#H
interpolation should now work.
Limitations
I wanted to get the current path of the opened ssh session but that's not possible. I haven't found a way to get the output of a remote command that will be executed on an opened ssh session. A dirty way would be to use send-keys pwd Enter
but this will show on the pane and we don't want this.
So, I'm just getting the correct ssh command corresponding to the pane job pid and parsing it, for example:
ssh test@host.com
# #H => host.com
# #U => test
License
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2