2018-05-12 11:53:45 +00:00
|
|
|
function fish_title
|
2020-06-17 14:42:35 +00:00
|
|
|
# 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
|
2022-03-06 12:14:22 +00:00
|
|
|
# If we're connected via ssh, we print the hostname.
|
|
|
|
set -l ssh
|
|
|
|
set -q SSH_TTY
|
2022-03-13 19:00:02 +00:00
|
|
|
and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]"
|
2020-11-28 06:53:12 +00:00
|
|
|
# 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.
|
2022-01-16 10:14:11 +00:00
|
|
|
if set -q argv[1]
|
2022-03-06 12:15:03 +00:00
|
|
|
echo -- $ssh (string sub -l 20 -- $argv[1]) (prompt_pwd -d 1 -D 1)
|
2022-01-16 10:14:11 +00:00
|
|
|
else
|
|
|
|
# Don't print "fish" because it's redundant
|
|
|
|
set -l command (status current-command)
|
|
|
|
if test "$command" = fish
|
|
|
|
set command
|
|
|
|
end
|
2022-03-06 12:14:22 +00:00
|
|
|
echo -- $ssh (string sub -l 20 -- $command) (prompt_pwd -d 1 -D 1)
|
2022-01-16 10:14:11 +00:00
|
|
|
end
|
2019-05-06 15:06:40 +00:00
|
|
|
end
|
2018-05-12 11:53:45 +00:00
|
|
|
end
|