From 7b01b4d3080cad2132da8758921d2e582361d9c2 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 6 Mar 2022 13:14:22 +0100 Subject: [PATCH] fish_title: Show hostname if connected via ssh See #8641 --- share/functions/fish_title.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/functions/fish_title.fish b/share/functions/fish_title.fish index b509b54ee..aa73ac6f4 100644 --- a/share/functions/fish_title.fish +++ b/share/functions/fish_title.fish @@ -1,17 +1,21 @@ function fish_title # emacs' "term" is basically the only term that can't handle it. if not set -q INSIDE_EMACS; or string match -vq '*,term:*' -- $INSIDE_EMACS + # If we're connected via ssh, we print the hostname. + set -l ssh + set -q SSH_TTY + and set ssh "[$(prompt_hostname | string sub -l 10)]" # An override for the current command is passed as the first parameter. # This is used by `fg` to show the true process name, among others. if set -q argv[1] - echo -- (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 0) + echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 0) else # Don't print "fish" because it's redundant set -l command (status current-command) if test "$command" = fish set command end - echo -- (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1) + echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1) end end end